Does it mutate 😱

Array.prototype.keys

No mutation

Description

The keys() method of Array instances returns a new array iterator object that contains the keys for each index in the array.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys

Example

const array1 = ['a', 'b', 'c'];
const iterator = array1.keys();

for (const key of iterator) {
  console.log(key);
}

// Expected output: 0
// Expected output: 1
// Expected output: 2