Map (initial support)Baseline · Widely available
Map objects hold key-value pairs and remember the original insertion order of the keys.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.
Browser support
DesktopChrome
1–37Not supported
38+Supportedsince Oct 7, 2014
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–12Not supported
13+Supportedsince Jun 5, 2012
Current: 157Safari
1–7Not supported
8+Supportedsince Oct 16, 2014
Current: 27MobileChrome Android
18–37Not supported
38+Supportedsince Oct 8, 2014
Current: 155Firefox Android
4–10Not supported
14+Supportedsince Jun 26, 2012
Current: 157Safari iOS
1–7Not supported
8+Supportedsince Sep 17, 2014
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: Map.
Feature detection
JS · check before using
if (typeof Map !== "undefined") {
// Map is available
}Documentation (MDN)
Specification
- tc39.es#sec-map-objects ↗
- tc39.es#sec-map-constructor ↗
- tc39.es#sec-map.prototype.clear ↗
- tc39.es#sec-map.prototype.delete ↗
- tc39.es#sec-map.prototype.entries ↗
- tc39.es#sec-map.prototype.foreach ↗
- tc39.es#sec-map.prototype.get ↗
- tc39.es#sec-map.prototype.has ↗
- tc39.es#sec-map.prototype.keys ↗
- tc39.es#sec-map.prototype.set ↗
- tc39.es#sec-get-map.prototype.size ↗
- tc39.es#sec-map.prototype.values ↗
- tc39.es#sec-map.prototype-@@iterator ↗
- tc39.es#sec-get-map-@@species ↗
Sub-features
Support for each part of the feature (17). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Map | 38 | 12 | 13 | 8 | 38 | 14 | 8 |
| Map.@@iterator | 38 | 12 | 36 | 10 | 38 | 36 | 10 |
| Map.@@species | 51 | 13 | 41 | 10 | 51 | 41 | 10 |
| Map.Map | 38 | 12 | 13 | 8 | 38 | 14 | 8 |
| Map.Map.iterable_allowed | 38 | 12 | 13 | 9 | 38 | 14 | 9 |
| Map.Map.null_allowed | 38 | 12 | 37 | 9 | 38 | 37 | 9 |
| Map.clear | 38 | 12 | 19 | 8 | 38 | 19 | 8 |
| Map.delete | 38 | 12 | 13 | 8 | 38 | 14 | 8 |
| Map.entries | 38 | 12 | 20 | 8 | 38 | 20 | 8 |
| Map.forEach | 38 | 12 | 25 | 8 | 38 | 25 | 8 |
| Map.get | 38 | 12 | 13 | 8 | 38 | 14 | 8 |
| Map.has | 38 | 12 | 13 | 8 | 38 | 14 | 8 |
| Map.key_equality_for_zeros | 38 | 12 | 29 | 9 | 38 | 29 | 9 |
| Map.keys | 38 | 12 | 20 | 8 | 38 | 20 | 8 |
| Map.set | 38 | 12 | 13 | 8 | 38 | 14 | 8 |
| Map.size | 38 | 12 | 19 | 8 | 38 | 19 | 8 |
| Map.values | 38 | 12 | 20 | 8 | 38 | 20 | 8 |