jskatas.org Continuously Learn JavaScript. Your Way.

Set: set.add()

Appends a new element to the end of 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.

add() appends a new element to the end of a Set object.

  • adds every value, of any type, only once
  • is chainable
  • call without params adds undefined
  • 0, -0 and +0 are equal