Does it mutate 😱
Array.prototype.entries
No mutation
Description
The entries()
method of Array
instances returns a new array iterator object that contains the key/value pairs for each index in the array.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries
Example
const array1 = ['a', 'b', 'c'];
const iterator1 = array1.entries();
console.log(iterator1.next().value);
// Expected output: Array [0, "a"]
console.log(iterator1.next().value);
// Expected output: Array [1, "b"]