Array Index

noun

say it: “uh-RAY IN-deks” /əˈreɪ ˈɪndɛks/

The number that says where an item sits in a JavaScript array. Counting starts at 0, so the first item is at index 0 and the second at index 1.

What is Array Index in JavaScript?

Array Index — A zero-based number that identifies an element's position in an array.

const stops = ["Oak", "Pine", "Lake"];
const secondStop = stops[1];
const stopCount = stops.length;

In a sentence

  • “I asked for the song at index 9 of a four-song playlist and got undefined back.”
  • “The first song on the playlist is at index 0, so playlist[0] gives me Highway Sunrise.”

Level: Apprentice · More JavaScript terms at this level

Updated

In other subjects