Live2D

ES6对象

---------------------------------------------------------------------

对象的扩展

let obj = {a: 1, b: 2, c: 3, d: 4};

Object.keys(obj).forEach((key,index)=>{ console.log(key); });

// 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]

posted @ 2019-04-01 16:28  Candice&Gladys  阅读(113)  评论(0编辑  收藏  举报