mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-13 18:56:35 +08:00
Merge pull request #252 from zhuoqinyue/master
Add Typescript and Javascript examples in data_and_memory.md
This commit is contained in:
@ -84,13 +84,17 @@ comments: true
|
|||||||
=== "JavaScript"
|
=== "JavaScript"
|
||||||
|
|
||||||
```js title=""
|
```js title=""
|
||||||
|
/* JavaScript 的数组可以自由存储各种基本数据类型和对象 */
|
||||||
|
const array = [0, 0.0, 'a', false];
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "TypeScript"
|
=== "TypeScript"
|
||||||
|
|
||||||
```typescript title=""
|
```typescript title=""
|
||||||
|
/* 使用多种「基本数据类型」来初始化「数组」 */
|
||||||
|
const numbers: number[] = [];
|
||||||
|
const characters: string[] = [];
|
||||||
|
const booleans: boolean[] = [];
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "C"
|
=== "C"
|
||||||
|
Reference in New Issue
Block a user