Below is the example of the Instanceof Operator.
var a = ["Geeks", "for", "Geeks"];
(a instanceof Array) + "<
(a instanceof Number);
var gfg = objectName instanceof objectType
objectName: States the name of Object.
Example-2: Demonstrating that String and Date objects are also a type of Object (derived from Object).
- Google Chrome
- Apple Safari
- What is the difference between is_a() function and instanceof in PHP?
- Ternary operator vs Null coalescing operator in PHP
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.