将对象数组中每一项的某个元素生成一个新的数组
2021-03-02 本文已影响0人
吃肉肉不吃肉肉
var array =[
{name:'lili',age:18},{name:'meimei',age:19}
]
let nameList = array.map(x=>{return x.name})
console.log(nameList)//['lili','meimei']
var array =[
{name:'lili',age:18},{name:'meimei',age:19}
]
let nameList = array.map(x=>{return x.name})
console.log(nameList)//['lili','meimei']