wiki/content/20200929162129-arrays.md

22 lines
400 B
Markdown
Raw Permalink Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-09-29
2024-05-06 20:40:05 +00:00
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!
```