从对象数组中提取某些属性组成新的对象数组

let arrold = [
                { name: "name1", age: "1", date: '2016-05-03' },
                { name: "name2", age: "2", date: '2016-05-02' },
                { name: "name3", age: "3", date: '2016-05-06' },
                { name: "name4", age: "4", date: '2016-05-04' },
                { name: "name5", age: "5", date: '2016-05-08' },
                { name: "name6", age: "6", date: '2016-05-02' }
            ]
            let arrnew = arrold.map((item, index) => {
                return Object.assign({}, { 'name': item.name, 'date': item.date })
            })
            console.log(arrnew)

 

posted @ 2022-12-21 15:57  宫圆薰  阅读(420)  评论(0编辑  收藏  举报