📜  在数组的对象中插入新的键值 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:45.543000             🧑  作者: Mango

代码示例1
var arrOfObj = [{
  name: 'eve'
}, {
  name: 'john'
}, {
  name: 'jane'
}];

var result = arrOfObj.map(function(el) {
  var o = Object.assign({}, el);
  o.isActive = true;
  return o;
})

console.log(arrOfObj);
console.log(result);
 Run code snippet