JavaScript Arrays The entries() method

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


The entries() method returns a new Array Iterator object that contains the key/value pairs for each index in the array.

var letters = ['a','b','c'];

for(const[index,element] of letters.entries()){


0 "a"
1 "b"
2 "c"

Note: This method is not supported in Internet Explorer.

Portions of this content from Array.prototype.entries by Mozilla Contributors licensed under CC-by-SA 2.5

Got any JavaScript Question?