var arr = [{ name:'张三', age :19, city:'石家庄' }, { name:'李四', age :18, city:'邢台' }, { name:'王小', age :18, city:'邯郸' }, ] 取出这个数组中的姓名和年龄 let newArr = []; arr.forEach((item) => { newArr.push( name: item.name, age: item.age, ); });
var arr = [{ name:'张三', age :19, city:'石家庄' }, { name:'李四', age :18, city:'邢台' }, { name:'王小', age :18, city:'邯郸' }, ] 取出这个数组中的姓名和年龄 let newArr = []; arr.forEach((item) => { newArr.push( name: item.name, age: item.age, ); });