profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

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

Related