1.去除数组中每一项的某个属性
去除arr数组中每一项的name属性
const arr = [
{ name: 'Alice', age: 25 },
{ name: 'Bob', age: 30 },
{ name: 'Charlie', age: 35 }
];
const newArr = arr.map(({ name, ...rest }) => rest);
console.log(newArr);
去除arr数组中每一项的name属性
const arr = [
{ name: 'Alice', age: 25 },
{ name: 'Bob', age: 30 },
{ name: 'Charlie', age: 35 }
];
const newArr = arr.map(({ name, ...rest }) => rest);
console.log(newArr);