Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Function.prototype[Symbol.hasInstance]()

2 tags 1 category

The Symbol.hasInstance method of Function instances specifies the default procedure for determining if a constructor function recognizes an object as one of the constructor’s instances. It is called by the instanceof operator.

The instanceof operator calls the [Symbol.hasInstance](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) method of the right-hand side whenever such a method exists. Because all functions inherit from Function.prototype by default, they would all have the Symbol.hasInstance method, so most of the time, the Function.prototypeSymbol.hasInstance method specifies the behavior of instanceof when the right-hand side is a function. This method implements the default behavior of the instanceof operator (the same algorithm when constructor has no Symbol.hasInstance method).

Syntax example: func[Symbol.hasInstance](value)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…