Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.
The Symbol.hasInstance static data property represents the well-known symbol Symbol.hasInstance. The instanceof operator looks up this symbol on its right-hand operand for the method used to determine if the constructor object recognizes an object as its instance.
The well-known symbol Symbol.hasInstance.
| Writable | no |
| Enumerable | no |
| Configurable | no |
The instanceof operator uses the following algorithm to calculate the return value of object instanceof constructor:
Because all functions inherit from Function.prototype by default, most of the time, the Function.prototype[Symbol.hasInstance]() method specifies the behavior of instanceof when the right-hand side is a function.
You could implement your custom instanceof behavior like this, for example:
Just in the same manner at which you can check if an object is an instance of a class using the instanceof keyword, we can also use Symbol.hasInstance for such checks.
| ECMAScript® 2027 Language Specification # sec-symbol.hasinstance |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.