RSRobince Studio

JavaScript Arrays

An array is an ordered list. Create one with square brackets, read items by their position (starting at 0), and use .length for the count.

let fruits = ["apple", "pear", "plum"]
console.log(fruits[0])      // "apple"
console.log(fruits.length)  // 3
Try it yourself

Loading editor…