Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

update property of object in array javascript

foo.forEach(function(obj) {
    if (obj.bar === 1) {
        obj.baz[0] = 11;
        obj.baz[1] = 22;
        obj.baz[2] = 33;
        // Or: `obj.baz = [11, 22, 33];`
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #update #property #object #array #javascript
ADD COMMENT
Topic
Name
8+6 =