JavaScript MCQ JavaScript Operator MCQ Question #4892
Single Choice Easy

QWhat is the result of the following code?

function foo() {}
console.log(foo instanceof Function);

ID: #4892 JavaScript Operator MCQ 176 views
Question Info
#4892Q ID
EasyDifficulty
JavaScript Operator MCQTopic

Choose the Best Option

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

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

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 foo has been assigned a function. The instanceof operator is called on foo, with Function as the right operand. Since foo is an instance of the Function constructor, the instanceof operator will return true.

Share This Question

Challenge a friend or share with your study group.