jskatas.org Continuously Learn JavaScript. Your Way.

Array API: array.keys()

Array.prototype.keys() returns an iterator for all keys in the array.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

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