Array.prototype.valuesintermediateconst arr = ['a', 'b', 'c']
[...arr.keys()] // β [0, 1, 2] (indices)
[...arr.values()] // β ['a','b','c'] (values)Use values() to iterate element values and keys() to iterate indices.
arr.keys() yields the indices, while arr.values() yields the elements. Both are iterators and work with Array.from.
Implement valuesAndKeys which returns an object with both keys and values arrays derived from the respective iterators.