JavaScript: Set.prototype.clear

By Xah Lee. Date: . Last updated: .

New in JS2015.

set_obj.clear()

Delete all values of the set set_obj.

Return undefined.

const s = new Set([3,4,5]);

// clear set

console.log( s.clear() ); // Returns undefined

console.log(s); // Set {}
JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Set

prototype