The instanceof operator in JavaScript returns a Boolean value, indicating whether the object is an instance of a specific class.
Usage:
result = object instanceof class
where result is a required option. Any variable.
object is required. Any object expression.
class is required. Any defined object class.
Explanation
If object is an instance of class, the instanceof operator returns true. Returns false if object is not an instance of the specified class, or if object is null.
Instanceof operator in JavaScript
The following example illustrates the usage of instanceof operator.