JS: Set.prototype

By Xah Lee. Date: . Last updated: .

New in ES2015.

Set.prototype is the value of the property key "prototype" of the function Set.

[see JS: Set Object]

console.log( Set.hasOwnProperty ( "prototype" ) ); // true


Type of Set.prototype is object.

[see JS: Value Types]

// type of Set.prototype
console.log ( typeof Set.prototype === "object" ); // true
console.log ( Object.prototype.toString.call( Set.prototype ) === "[object Set]" ); // true


Parent of Set.prototype is Object.prototype.

// parent of Set.prototype
console.log ( Object.getPrototypeOf ( Set.prototype ) === Object.prototype ); // true

[see JS: Prototype and Inheritance]


Purpose of Set.prototype is to provide methods and properties useful for all set instances.

Set.prototype is the parent of all set instances.

console.log ( Object.getPrototypeOf ( new Set() ) === Set.prototype ); // true

[see JS: the Set Object Tutorial]



ECMAScript 2015 §Keyed Collection#sec-properties-of-the-set-prototype-object

Set Topic

  1. JS: the Set Object Tutorial
  2. JS: Set Union, Intersection, Difference
  3. JS: Set Object
  4. JS: Set.prototype
  5. JS: Set.prototype.forEach
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

Patreon me $5. Ask me question on patreon