map:提取部分属性值
let arr = [ { code: "12", type: "js", id: 17 }, { code: "23", type: "css", id: 19 } ]; let list = arr.map(({ type, id }) => { return { type, id }; });
2022-05-10 14:08:00
let arr = [ { code: "12", type: "js", id: 17 }, { code: "23", type: "css", id: 19 } ]; let list = arr.map(({ type, id }) => { return { type, id }; });