The keys() method of an array returns an iterator object that contains the keys for each index in the array.
const numbers = ['a', 'b', 'c'];
// iterator object
const iterator = numbers.keys();
for (const key of iterator) {
console.log(key);
}
// 0
// 1
// 2