首页 > 其他 > 详细

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

时间:2017-11-29 22:26:09      阅读:253      评论:0      收藏:0      [点我收藏+]

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()

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!