mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 13:06:22 +00:00
29 lines
686 B
Markdown
29 lines
686 B
Markdown
|
---
|
||
|
id: e7ed8c3a-ee07-4d46-ace9-f354ee4a47b2
|
||
|
title: JavaScript Arrays
|
||
|
---
|
||
|
|
||
|
- [Array Prototype
|
||
|
Methods](20201009090331-javascript_array_prototype_methods)
|
||
|
- [Array Functions](20201113103917-javascript_array_functions)
|
||
|
- [Destructuring Arrays](20201103111509-destructuring_arrays)
|
||
|
|
||
|
# Syntax
|
||
|
|
||
|
``` javascript
|
||
|
let listOfNumbers = [2, 3, 5, 7, 11];
|
||
|
console.log(listOfNumbers[2]); // 5
|
||
|
console.log(listOfNumbers[0]); // 2
|
||
|
```
|
||
|
|
||
|
# Type
|
||
|
|
||
|
In JavaScript arrays are a type of [object](20200826201605-objects) that
|
||
|
store sequences of things. `typeof` wil therefore return "object"
|
||
|
|
||
|
``` javascript
|
||
|
let listOfThings = ["Car", "Mr Magoo", 42];
|
||
|
|
||
|
console.log(typeof listOfThings); // object
|
||
|
```
|