Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js add key to object

// given
const obj = {
    key1: value1,
    key2: value2
};

// add pair
obj["key3"] = value3;
obj.key4 = value4;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #add #key #object
ADD COMMENT
Topic
Name
2+5 =