<strong>entries()</strong>
方法返回一个 <strong>Array Iterator</strong>
对象,该对象包含数组中每一个索引的键值对。
<strong>entries()基本语法:</strong>
<code class="language-javascript">arr.entries()</code>
<strong>entries()参数说明:</strong>
参数名 | 参数说明 |
arr | 需要处理的数组 |
<strong>entries()实例:</strong>
<code class="language-javascript">var arr = ["a", "b", "c"]; var eArr = arr.entries(); console.log(eArr.next().value); // [0, "a"] console.log(eArr.next().value); // [1, "b"] console.log(eArr.next().value); // [2, "c"]</code>