JS Built-ins
SymbolhasInstancebeginner

Symbol.hasInstance β€” standard instanceof still works

πŸ“– Usage Example
[] instanceof Array     // β†’ true
({}) instanceof Object  // β†’ true

The standard instanceof operator uses Symbol.hasInstance internally on the right-hand operand.

Standard instanceof

Even without customisation, [] instanceof Array still works normally.

Challenge: Verify the standard instanceof behaviour.

πŸ’‘ Hints (1)
  • β€’ instanceof uses Symbol.hasInstance internally on the right-hand side.