Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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); 
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to create variables using javascript 
Javascript :: how does an if statement work 
Javascript :: como agregar items en un array javascript 
Javascript :: hasOwnProperty.call js 
Javascript :: row append and calculation in jquery datatable 
Javascript :: javascript prompt on window close 
Javascript :: angular tooltip text ngif 
Javascript :: js remove several elements from array 
Javascript :: javascript onsubmit change input value 
Javascript :: vue js multiple dynamic classes 
Javascript :: how to create module in react 
Javascript :: use of parse in react 
Javascript :: is javascript loosely typed 
Javascript :: using settings_data.json shopify 
Javascript :: share data between livewire and alpine js 
Javascript :: Material-ui account box icon 
Javascript :: is already declared javascript 
Javascript :: jstree get_json 
Python :: python most used functions 
Python :: python shebang 
Python :: python subtract months from date 
Python :: install telethon 
Python :: python read json file 
Python :: python pandas save df to xlsx file 
Python :: bored 
Python :: how to check python version 
Python :: copy to clipboard python 
Python :: how to simulate a key press in python 
Python :: use incognito in selenium webdriver 
Python :: how to capture an image with web cam open cv 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =