THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript Array entries() Method

❮ JavaScript Array Reference

Example

Create an Array Iterator object, with key/value pairs for each item in the fruit array:

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

Definition and Usage

The entries() method returns an Array Iterator object with key/value pairs.

For each item in the original array, the new iteration object will contain an array with the index as the key, and the item value as the value:

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


Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
entries() 38.0 12.0 28.0 8 25.0

Syntax

array.entries()

Parameter Values

No parameters.

Technical Details

Return Value: An Array Iterator object
JavaScript Version: ECMAScript 6

❮ JavaScript Array Reference