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.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
