.clear()

The .clear() method deletes all values from a Set and returns undefined.

Syntax

set.clear();

No parameters are needed for the .clear() method.

Codebyte Example

Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback form.

Learn JavaScript on Codecademy