Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to add element to an object

const favoriteThings = {
  band: 'caravan palace',
  food: 'fried pickles',
}

//object notation
favoriteThings.car = 'my car'
//bracket notation 
favoriteThings['car'] = 'my car'
 
PREVIOUS NEXT
Tagged: #add #element #object
ADD COMMENT
Topic
Name
8+4 =