- A 1
- B 2
- C 6
- D 8
- Share this MCQ
Answer:
B
Share this MCQ
The Map
data type in JavaScript is a constructor that creates a new map object, which is a collection of key-value pairs.
The set
method is used to add a new key-value pair to the map object.
In this case, two key-value pairs are added to the map object using the set
method.
The size property is used to get the number of key-value pairs in the map
object.
Since there are 2 key-value pairs in the map object, the size property will return 2
.
Share this MCQ