Operators
instanceof operator
Tests instance membership using a custom Symbol.hasInstance method when present, otherwise ordinarily checking the constructor prototype chain for objects. It is not a universal cross-realm type test.
Formal Syntax & Structure
javascript syntaxjavascript
value instanceof ConstructorParameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | Any | Value to test. |
| Constructor | Object | Right-hand operand with valid instance checking behavior. |
Return Value
Boolean
Instance check.
Working Example
Example Snippetjavascript
function F(){}console.log(new F() instanceof F,{} instanceof F);