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]

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.

console.log ( Reflect.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 ( Reflect.getPrototypeOf ( new Set() ) === Set.prototype ); // true

[see JS: the Set Object Tutorial]


JS Set

  1. Set Tutorial
  2. Union, Intersection, Difference

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials