jskatas.org Continuously Learn JavaScript. Your Way.

Set: set.clear()

Removes all elements from a Set object.

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.

clear() removes all elements from a Set object.

  • set.size becomes 0
  • the iterator set.entries() will not contain any items
  • any call to set.has() returns false
  • returns undefined


How the implementation is specified.
The MDN docs.
Announcement of this kata on twitter.