码迷,mamicode.com
首页 > 其他好文 > 详细

[ES2017] Iterate over properties of an object with ES2017 Object.entries()

时间:2017-11-29 22:42:39      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:obj   col   foo   object   div   nbsp   asc   span   func   

The Object.entries() function is an addition to the ECMAscript scpec in Es2017. This allows us to iterate through the properties of an object and read the entries as keys and objects.

 

const obj = { foo: ‘bar‘, baz: 42 };
console.log(Object.entries(obj)); // [ [‘foo‘, ‘bar‘], [‘baz‘, 42] ]

 

[ES2017] Iterate over properties of an object with ES2017 Object.entries()

标签:obj   col   foo   object   div   nbsp   asc   span   func   

原文地址:http://www.cnblogs.com/Answer1215/p/7923017.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!