ES6 Object.forOwn loop over object keys functionality
This question already has an answer here:
ES2017引入了Object.entries()
方法,该方法似乎是您要查找的内容:
const obj = { a: 1, b: 2 };
Object.entries(obj).forEach(([key, value]) => console.log(`key: ${key}, value: ${value}`));
链接地址: http://www.djcxy.com/p/28840.html
上一篇: 如何循环浏览JSON对象