Arrays

  • Arrays hold ordered lists of values
  • Positions start at 0
const myFavoriteNumbers = [1,2,3];
const names = ["Alice", "Bob", "Eve"];
const mixed = ["Alice", 2, false];

for(const element of mixed) {
    console.log(element);
}

console.log(mixed[0]);
mixed[3] = "something";
"Alice"
2
false
"something"

18 / 21