Add param to all objects in an Array - Javascript -
i have array of objects like:
[ { title: 'title 1', value: 'value 1' }, { title: 'title 2', value: 'value 2' } ]
i need add new param objects.
i know can on array , modify each object, i'm trying find way solve native method. exists?
var arrayobj=[ { title: 'title 1', value: 'value 1' }, { title: 'title 2', value: 'value 2' } ]; arrayobj.foreach(function(obj){ obj.newprop='new'; }); console.log(arrayobj);
Comments
Post a Comment