What is `Symbol.hasInstance` used for in JavaScript?

JavaScript Professional Medium

JavaScript Professional — Medium

What is `Symbol.hasInstance` used for in JavaScript?

Key points

  • `Symbol.hasInstance` customizes `instanceof` behavior
  • Helps define custom type checking rules
  • Not used to check if a Symbol value is an instance of a specific type
  • Does not return the class that created a Symbol value

Ready to go further?

Related questions