wiki/content/20200826201029-arrays.md

703 B

date id title
2020-08-26 e7ed8c3a-ee07-4d46-ace9-f354ee4a47b2 JavaScript Arrays

Syntax

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 that store sequences of things. typeof wil therefore return "object"

let listOfThings = ["Car", "Mr Magoo", 42];

console.log(typeof listOfThings); // object