📌  相关文章
📜  更改对象数组中键的值 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:30.627000             🧑  作者: Mango

代码示例3
const arrayOfObj = [{
  key1: 'value1',
  key2: 'value2'
}, {
  key1: 'value1',
  key2: 'value2'
}];
const newArrayOfObj = arrayOfObj.map(({
  key1: stroke,
  ...rest
}) => ({
  stroke,
  ...rest
}));

console.log(newArrayOfObj);