Array.prototype.keysbeginnerconst arr = ['x', 'y', 'z']
[...arr.keys()].length // β 3 (same as arr.length)Spreading keys() into an array lets you count or work with the set of indices.
The number of keys yielded by arr.keys() is always the same as arr.length. This exercise makes that relationship explicit.
Challenge: Implement countKeys(arr) that returns the number of keys in the array (i.e. how many indices exist).
countKeys([10, 20, 30]) // β 3
countKeys([]) // β 0