在for..in
循环中,
为什么作为o.i
访问的属性的值返回undefined
,而o[i]
返回正确的值?
供参考的代码片段:
var object = {
id:2,
name:'axs',
address:'colon street'
};
for(let property in object){
console.log(object.property); // returns undefined
console.log(object[property]); // returns property-value
}
https://stackoverflow.com/questions/51925737
复制相似问题