MCQ Practice Single Best Answer Topic: JavaScript Operator MCQ

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

Question ID
#4891
Subchapter
JavaScript Operator MCQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A true
  • B false
  • C "true"
  • D "false"
Correct Answer: 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

Share this MCQ with your friends or study group.