JavaScript Map constructor Property
The map constructor property in JavaScript is used to return the map constructor function for the object. The function which is returned by this property is just the reference to this function, not a map containing the function’s name. The JavaScript map constructor, string constructor, and boolean constructor return function Map() { [native code] }, function String() { [native code] }, and function Boolean() { [native code] } respectively.
Syntax:
map.constructor
Return Value: Map() { [native code] }
Example 1: This example shows the basic use of the Map constructor property in JavaScript.
Javascript
function func() { let map1 = new Map([ [1, 2], [2, 3], [4, 5] ]); let value = map1.constructor; console.log(value); } func(); |
Output:
ƒ Map() { [native code] }
Example 2: This example uses the Map constructor Property of Javascript.
Javascript
function myBeginner() { let map1 = new Map([ [1, 2], [2, 3], [4, 5] ]); console.log(map1.constructor); } myBeginner() |
[Function: Map]
Supported Browsers:
- Chrome
- Edge
- Firefox
- Safari
- Opera
- Internet Explorer
We have a complete list of JavaScript Map methods, to check those please go through the JavaScript Map Reference article
Contact Us