Predict the output of the following javascript code

console.log('abc' instanceof String);

 

 

 

 

In JavaScript, the instanceof operator checks whether an object is an instance of a particular class or constructor function.

In this code snippet, 'abc' is a primitive string value, not an instance of the String object.

When you use 'abc' instanceof String, JavaScript internally wraps the primitive string value 'abc' into a temporary String object to perform the check. However, after the check, this temporary object is discarded.

Since 'abc' is not an instance of the String object (it's a primitive string), the expression evaluates to false.

So, the output of the given code will be:

false