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

javascript entries() 方法

WBOY
Release: 2016-06-01 09:54:24
Original
3155 people have browsed it

<strong>entries()</strong> 方法返回一个 <strong>Array Iterator</strong> 对象,该对象包含数组中每一个索引的键值对。

<strong>entries()基本语法:</strong>

<code class="language-javascript">arr.entries()</code>
Copy after login

 

<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>
Copy after login

 

Related labels:
js
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template