Array.prototype.keys
returns an iterator for all keys in the array
keys()
returns an iterator
gets all keys
empty array contains no keys
a sparse array without real values has keys though
also includes holes in sparse arrays
Required Knowledge
- `const` declaration (Block scope)
- array (Destructuring)
- `Array.from()` (Array API)
- protocol (Iterator)
Related Katas
Array API
array.sort()
basicsarray.sort()
can take a compare functionarray.shift()
(as introduced in ES3)array.push()
(as introduced in ES3)Array.from()
Array.of()
array.fill()
array.find()
array.findIndex()
array.entries()
array.keys()
array.values()
array.includes()
array.toReversed()
Difficulty Level
INTERMEDIATE
First Published
19 May 2015
Stats
5 tests to solve