JavaScript entries()Method

Array 对象参考手册JavaScript Array Object

Example

Create an iterable object from the array fruit, which contains the key/value pairs of the array:

var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.entries();

Try it Yourself »

Definition and Usage

The entries() method returns an array iterable object that contains the key/value pairs of the array.

In the iterable object, the index value of the array is used as the key, and the array element is used as the value.

[0, "Banana"]
[1, "Orange"]
[2, "Apple"]
[3, "Mango"]

Browser Support

The numbers in the table indicate the first browser version that supports this method.

Method
entries() 38.0 12.0 28.0 8 25.0

Syntax

array.entries()

Parameters

No parameters.

Technical Details

Return value: Array iterator object
JavaScript Version: ECMAScript 6


Array 对象参考手册JavaScript Array Object

Other Extensions