mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 21:16:21 +00:00
21 lines
383 B
Markdown
21 lines
383 B
Markdown
|
---
|
||
|
id: aea39282-589d-49ab-8b50-c55c7681f500
|
||
|
title: TypeScript Arrays
|
||
|
---
|
||
|
|
||
|
# Syntax
|
||
|
|
||
|
``` typescript
|
||
|
var boolArray: boolean[];
|
||
|
|
||
|
boolArray = [true, false];
|
||
|
console.log(boolArray[0]); // true
|
||
|
console.log(boolArray.length); // 2
|
||
|
boolArray[1] = true;
|
||
|
boolArray = [false, false];
|
||
|
|
||
|
boolArray[0] = 'false'; // Error!
|
||
|
boolArray = 'false'; // Error!
|
||
|
boolArray = [true, 'false']; // Error!
|
||
|
```
|