JavaScript: Set.prototype.clear

By Xah Lee. Date: . Last updated: .

New in JS2015.

setObj.clear()
  • Delete all values of the set setObj.
  • Return undefined.
const s = new Set([3,4,5]);

// clear set

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

console.log(s); // Set {}
BUY
ΣJS
JavaScript in Depth

JS Obj Reference

Set

prototype