Single Choice Easy

QWhat is the result of the following code?
var map = new Map();
console.log(map instanceof Map);

ID: #4894 JavaScript Operator MCQ 232 views
Question Info
#4894Q 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

Explanation

The Map data type in JavaScript is a constructor that creates a new map object, which is a collection of key-value pairs.
The Map constructor creates a new map object when it is called using the new keyword.
In this case, a new map object is created using the Map constructor, and is assigned to the variable map.
The instanceof operator is called on map, with Map as the right operand.
Since map is an instance of the Map constructor, the instanceof operator will return true.

Share This Question

Challenge a friend or share with your study group.