mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 01:06:28 +08:00
fix the expression
This commit is contained in:
parent
eb3f1b61a6
commit
b6b8ae902d
1 changed files with 4 additions and 6 deletions
|
@ -85,18 +85,16 @@ comments: true
|
||||||
|
|
||||||
```js title=""
|
```js title=""
|
||||||
// JavaScript 的数组可以自由存储各种基本数据类型和对象
|
// JavaScript 的数组可以自由存储各种基本数据类型和对象
|
||||||
// JavaScript 的基本数据类型中只有数字, 没有浮点数, 这里使用0.1作为示例
|
const array = [0, 0.0, 'a', false];
|
||||||
const array = [0, 0.1, 'a', false]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "TypeScript"
|
=== "TypeScript"
|
||||||
|
|
||||||
```typescript title=""
|
```typescript title=""
|
||||||
// TypeScript 可以定义 JavaScript 数组的类型
|
// TypeScript 可以定义 JavaScript 数组的类型
|
||||||
const numbers: number = new Array(5).fill(0);
|
const numbers: number = []
|
||||||
const decimals: number = new Array(5).fill(0.1);
|
const characters: string = []
|
||||||
const characters: string = new Array(5).fill('a');
|
const booleans: boolean = []
|
||||||
const booleans: boolean = new Array(5).fill(true);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "C"
|
=== "C"
|
||||||
|
|
Loading…
Reference in a new issue