var gfg = objectName instanceof objectType
Parameters: This method accepts a single parameter.
- 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.
Example 3: Demonstrating that String and Date objects are also a type of Object (derived from Object).
true false true true true false
- Google Chrome
- Apple Safari
Please Login to comment...