Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Add property to all objects in array

var array = [ {'a': '12', 'b':'10'}, {'a': '20', 'b':'22'} ];

var r = array.map( x => {
  x.c = true;
  return x
  })

console.log(r)
 Run code snippet
 //[ { a: '12', b: '10', c: true }, { a: '20', b: '22', c: true } ]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Add #property #objects #array
ADD COMMENT
Topic
Name
9+7 =