擅长:python、mysql、java
<p>在ECMAScript 2015 aka ES6中,可以使用<a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of" rel="noreferrer">for..of loop</a>在对象数组上循环。</p>
<pre><code>for (let item of items) {
console.log(item); // Will display contents of the object inside the array
}
</code></pre>
<p>在发布这个答案时,对Internet Explorer的支持是不存在的,但是通过使用Traceur或Babel这样的transpiler,您可以使用这样的新Javascript功能,而不必真正担心浏览器支持什么。</p>