VOOZH about

URL: https://www.geeksforgeeks.org/javascript/instanceof-operator-in-javascript/

⇱ JavaScript Instanceof Operator - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Instanceof Operator

Last Updated : 11 Jul, 2025

The instanceof operator in JavaScript is used to check the type of an object at run time. It returns a boolean value if true then it indicates that the object is an instance of a particular class and if false then it is not. 

Syntax:

let gfg = objectName instanceof objectType

Parameters:

  • objectName: States the name of the Object.

Return Value: This method returns a boolean value if true then it indicates that the object is an instance of a particular class and if false then it is not. 

Example 1: Below is the example of the Instanceof Operator.

Output:

👁 JavaScript Instanceof Operator
JavaScript Instanceof Operator

Example 2: Below is the example of the Instanceof Operator.

Output:

👁 JavaScript Instanceof Operator
JavaScript Instanceof Operator

Example 3: Demonstrating that String and Date objects are also a type of Object (derived from Object). 

Output:

true
false
true
true
true
false

We have a complete list of Javascript Operators, to check those please go through the Javascript Operators Complete Reference article.

Supported Browsers:

  • Google Chrome
  • Firefox
  • Edge
  • Opera
  • Apple Safari
Comment