Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

Maps are Objects

typeof returns object:

Example

// Returns object:
typeof fruits;

instanceof Map returns true:

Example

// Returns true:
fruits instanceof Map;

JavaScript Objects vs Maps

Differences between JavaScript Objects and Maps:

Object

Map

Not directly iterable.

Iterable directly.

Lack a size property.

Contain a size property.

Keys must be strings or symbols.

Keys can be of any data type.

Keys are not guaranteed to be ordered.

Keys are ordered based on their insertion.

Have predefined keys.

Do not have predefined keys.

Browser Support

Map is an ES6 feature (JavaScript 2015), and ES6 has been fully supported in all modern browsers since June 2017.

browser

 

Map is not supported in Internet Explorer.