如果想要获取到arr数组对象中key为name的属性,需要用到引号
let arr = [ { name: '1', prop: '123' }, { name: '2', prop: '111' } ] arr.forEach(item => { console.log('123', item['name']) })
console值为
// 123 1
// 123 2
标签:arr,console,name,item,获取,123,数组,属性 From: https://www.cnblogs.com/zengyu123/p/17504659.html