ES6 - Collections Set Method clear()


Advertisements

This function clears all objects from the Set.

Syntax

mySet.clear();

Return Value

Undefined

Example

var mySet = new Set('tom','jim','jack'); 
mySet.clear() 
var tot = mySet.size; 
console.log(tot);

Output

0
es6_collections.htm
Advertisements