values in the order of entry insertion.  |  Although the keys of an ordinary ` Object ` are ordered now, this was not always the case, and the order is complex. As a result, it's best not to rely on property order.  The order was first defined for own properties only in ECMAScript 2015; ECMAScript 2020 defines order for inherited properties as well. But note that no single mechanism iterates **all** of an object's properties; the various mechanisms each include different subsets of properties. ( [ ` for-in ` ](/en-US/docs/Web/JavaScript/Reference/Statements/for...in) includes only enumerable string-keyed properties; [ ` Object.keys ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) includes only own, enumerable, string-keyed properties; [ ` Object.getOwnPropertyNames ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames) includes own, string-keyed properties even if non-enumerable; [ ` Object.getOwnPropertySymbols ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols) does the same for just ` Symbol ` -keyed properties, etc.)   
Size  |  The number of items in a ` Map ` is easily retrieved from its [ ` size ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size) property.  |  Determining the number of items in an ` Object ` is more roundabout and less efficient. A common way to do it is through the [ ` length ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) of the array returned from [ ` Object.keys() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) .   
Iteration  |  A ` Map ` is an [ iterable ](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) , so it can be directly iterated.  |  ` Object ` does not implement an [ iteration protocol ](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) , and so objects are not directly iterable using the JavaScript [ for...of ](/en-US/docs/Web/JavaScript/Reference/Statements/for...of) statement (by default).  **Note:**

  * An object can implement the iteration protocol, or you can get an iterable for an object using [ ` Object.keys ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) or [ ` Object.entries ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries) . 
  * The [ for...in ](/en-US/docs/Web/JavaScript/Reference/Statements/for...in) statement allows you to iterate over the _enumerable_ properties of an object. 

  
Performance  |  Performs better in scenarios involving frequent additions and removals of key-value pairs.  |  Not optimized for frequent additions and removals of key-value pairs.   
Serialization and parsing  |  No native support for serialization or parsing.  (But you can build your own serialization and parsing support for ` Map ` by using [ ` JSON.stringify() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) with its _replacer_ argument, and by using [ ` JSON.parse() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) with its _reviver_ argument. See the Stack Overflow question [ How do you JSON.stringify an ES6 Map? ](https://stackoverflow.com/q/29085197/) ).  |  Native support for serialization from [ ` Object ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) to JSON, using [ ` JSON.stringify() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) .  Native support for parsing from JSON to [ ` Object ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) , using [ ` JSON.parse() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) .   
  
###  Setting object properties

Setting Object properties works for Map objects as well, and can cause
considerable confusion.

Therefore, this appears to work in a way:

js

    
    
    const wrongMap = new Map();
    wrongMap["bla"] = "blaa";
    wrongMap["bla2"] = "blaaa2";
    
    console.log(wrongMap); // Map { bla: 'blaa', bla2: 'blaaa