bracket notation example

Solutions on MaxInterview for bracket notation example by the best coders in the world

showing results for - "bracket notation example"
Noah
16 Feb 2019
1let cargoHold = ['oxygen tanks', 'space suits', 'parrot', 
2                 'instruction manual', 'meal packs', 'slinky', 
3                 'security blanket'];
4
5/*a) Use bracket notation to replace ‘slinky’ with ‘space tether’. 
6Print the array to confirm the change.*/
7
8cargoHold[5] = "space tether"; 
9console.log(cargoHold); 
10
11//OR// cargoHold.splice(5,1, 'space tether');
12// console.log(cargoHold);