例如: 源数据: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));
2.1m questions
2.1m answers
60 comments
57.0k users