js 对象记录一下:
let obj_1 = { ?name : ‘james‘, ?age : ‘22‘, ?sex: ‘1‘}for ( i in obj_1 ){console.log(i) ???// 遍历属性 name ??ageconsole.log(obj_1 [i]) ???//遍历值 name ??age}Object.keys(obj_1); // 属性转成数组
// 取第3个属性var s = 0;for ( i in obj_1){if (++s == 3) break;}console.log(i)//或者Object.keys(obj_1)[2]
.
js 操作对象 记录
原文地址:https://www.cnblogs.com/xiangsj/p/9346016.html