MCQ Single Best Answer Easy

QWhat is the result of the following code?
var obj = {};
console.log(obj instanceof Object);
                    

ID: #4891 JavaScript Operator MCQ 166 views
Question Info
#4891Q ID
EasyDifficulty
JavaScript Operator MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A true
  • B false
  • C "true"
  • D "false"
Correct Answer: Option A

Explanation

The instanceof operator in JavaScript is used to determine whether an object is an instance of a particular constructor or class.
In this case, the variable obj has been assigned an empty object.
The instanceof operator is called on obj, with Object as the right operand.
Since obj is an instance of the Object constructor, the instanceof operator will return true.

Share This Question

Challenge a friend or share with your study group.