例如: 源数据:let oldList=[{code:2001,name:张三,}{code:2002,name:李四,},{code:2003,name:王五,}]
期望得到: let newList=[{code:2001,2002,2003}]
let oldList=[{code:2001,name:'张三'},{code:2002,name:'李四'},{code:2003,name:'王五'}] const list = oldList.map(item => { return { code: item.code } }); console.log(JSON.stringify(list));
1.4m articles
1.4m replys
5 comments
57.0k users