Home  >  Article  >  Web Front-end  >  javascript entries() 方法

javascript entries() 方法

WBOY
WBOYOriginal
2016-06-01 09:54:243099browse

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

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn