AlgoCademy
Lesson
Code

Updating array elements in {lang}


Unlike strings, the entries of arrays are mutable and can be changed freely, using indices and the bracket notation:

let myArray = ["Hello world!", 32, false];

myArray[1] = "second element";
myArray[2] = -60;

console.log(myArray); // Output: ["Hello world!", "second element", -60]

Assignment
Follow the Coding Tutorial and let's play with some arrays.


Hint
Look at the examples above if you get stuck.