Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

assign key and value to object

function updateObjectWithKeyAndValue(object, key, value) {
    return Object.assign({}, object, { [key]: value })  
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #assign #key #object
ADD COMMENT
Topic
Name
2+5 =