📅  最后修改于: 2022-03-11 15:01:58.200000             🧑  作者: Mango
const data = [
{ foo: 1, bar: 2 },
{ foo: 2, bar: 3 },
{ foo: 3, bar: 4 },
];
const increment = a => a + 1;
const result = data.map(o => ({ ...o, foo: increment(o.foo) }));
console.log(result);
Run code snippet