Jump to content

JavaScript: Difference between revisions

Line 206: Line 206:
* Do not use <code>[]</code> to get or set from the map
* Do not use <code>[]</code> to get or set from the map
* Iterating over a Map will be in order of insertion
* Iterating over a Map will be in order of insertion
;Saving as json
See [https://2ality.com/2015/08/es6-map-json.html es6 map json]<br>
<syntaxhighlight lang="javascript">
const data = JSON.stringify([...myMap]);
myMap = new Map(JSON.parse(data));
</syntaxhighlight>


===Set===
===Set===