* for in
for (var prop in o) {
if (o.hasOwnProperty(prop)) {
console.log(o[prop]);
}
}
* Object keys
Object.keys(o).forEach(function(key, idx) {
console.log( o[key] );
})
* for in
for (var prop in o) {
if (o.hasOwnProperty(prop)) {
console.log(o[prop]);
}
}
* Object keys
Object.keys(o).forEach(function(key, idx) {
console.log( o[key] );
})
转载于:https://www.cnblogs.com/mingzhanghui/p/9355682.html