Javascript Array entries()

The JavaScript Array entries() method returns a new Array Iterator object containing key/value pairs for each array index.

The syntax of the entries() method is:


Here, arr is an array.

entries() Parameters

The entries() method does not have any parameters.

Return value from entries()

  • Returns a new Array iterator object.

Note: The entries() method does not change the original array.

Example: Using entries() method

const languages = ["JavaScript", "Java", "C", "C++", "Python", "Lua"];
let iterator = languages.entries();

for (let entry of iterator) {


[ 0, 'JavaScript' ]
[ 1, 'Java' ]
[ 2, 'C' ]
[ 3, 'C++' ]
[ 4, 'Python' ]
[ 5, 'Lua' ]

Recommended Reading: JavaScript Array keys()

Did you find this article helpful?