set.delete()
deletes an element from a set
use delete(<value>)
to delete an element
delete()
returns true
when the element was found
and the size decreases
if nothing was deleted (no element with the given value was found)
returns false
undefined
is a valid value in a set
deleting it, when it is not in the set, returns false
too
delete()
removes it, when its in the set
the value does NOT get casted
number 1 is different to string "1"
Links
Announcement of this kata on twitter.
Required Knowledge
- `let` declaration (Block scope)
- `const` declaration (Block scope)
- basics (Set)
- `set.add()` (Set)
Related Katas
Set
- basics
set.add()
set.delete()
- the API
set.clear()
Difficulty Level
BEGINNER
First Published
15 July 2015
Stats
6 tests to solve