Answers for "Bracket Notation Example"

-1

Bracket Notation Example

let cargoHold = ['oxygen tanks', 'space suits', 'parrot', 
                 'instruction manual', 'meal packs', 'slinky', 
                 'security blanket'];

/*a) Use bracket notation to replace ‘slinky’ with ‘space tether’. 
Print the array to confirm the change.*/

cargoHold[5] = "space tether"; 
console.log(cargoHold); 

//OR// cargoHold.splice(5,1, 'space tether');
// console.log(cargoHold);
Posted by: Guest on June-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language