ES6对象
---------------------------------------------------------------------
对象的扩展
let obj = {a: 1, b: 2, c: 3, d: 4};
Object.keys(obj).forEach((key,index)=>{ console.log(key); });
// a b c d
===============================
let obj = {a: 1, b: 2, c: 3, d: 4};
Object.values(obj).forEach((value,index)=>{ console.log(value); });
// 1 2 3 4
=================================
let obj = {a: 1, b: 2, c: 3, d: 4};
Object.entries(obj).forEach((entry,index)=>{
console.log(entry);
});
// ["a", 1] ["b", 2] ["c", 3] ["d", 4]