Standard built-ins

Symbol.hasInstance

Try the free JavaScript compiler

Key for a custom instanceof membership predicate on the right operand; the result is converted to Boolean.

Formal Syntax & Structure

javascript syntaxjavascript
Symbol.hasInstance

Return Value

symbol

The predefined protocol key.

Working Example

Example Snippetjavascript
const positive={[Symbol.hasInstance](x){return x>0;}};console.log(2 instanceof positive);
JavaScript Reference