Easy Tutorial
❮ Prop Style Transitionproperty Dom Obj Colgroup ❯

JavaScript entries() Method

JavaScript Array Object

Example

Create an iterable object from the array fruits, which contains the key-value pairs of the array:

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

Definition and Usage

The entries() method returns an array iterator object, which contains the key-value pairs (key/value) of the array.

The index 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 specify the first browser version that fully supports the method.

Method Chrome Edge Firefox Safari Opera
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 |


JavaScript Array Object

❮ Prop Style Transitionproperty Dom Obj Colgroup ❯