Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to add key value pair in object

// program to add a key/value pair to an object

const person = {
    name: 'Monica',
    age: 22,
    gender: 'female'
}

// add a key/value pair
person.height = 5.4;

console.log(person);
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #add #key #pair #object
ADD COMMENT
Topic
Name
4+7 =