引用/分析对象
这个问题在这里已经有了答案:
var x = {4214061251:1,2497227651:2,4214140739:2};
// Array of all keys 4214061251, 2497227651 ...
var keysArr = Object.keys(x);
console.log(keysArr);
// Iterate on keys
keysArr.forEach(
(el) => {
// To access keys
console.log("Key: "+el);
// To access values instead
console.log("Value: "+x[el]);
}
)
链接地址: http://www.djcxy.com/p/52013.html