<Script> / * Map data structure is introduced ES6, which is a class object, the object can only use common key string, and the keys of the map data structure may be used in any object, without limitation Map is a constructor, by new Map () to construct if necessary key to the data format, Map Object more suitable than if the same key repeatedly assigned, then the previous values will be replaced after have to traverse the same method set data structure traversal is the data sequence order of insertion into an array of structures can be used to expand the operator ... * / the let Map = new new the Map ([ [{a: 'a'}, 123 ], [[], 'B' ], [ function () {} 'array' ] ]); // method map.set (1,1); // SET () to add value as map.get (. 1); // read values map.size; // get the number of members map.has (1); // verify whether the current data structure and returns a Boolean value of the Map. the Delete (1); // delete the value map.clear (); // delete all values // traversal methods map.prototype.keys (); // traversal keys map.prototype.values (); // traversal key map.prototype.entries (); // traversal key to map.prototype .forEach (); // loop through all members </ script>
As a white front-end, Typescript have come, how can you not grasp ES6 it?
We have to keep up with the script of the times, or only out of it.
This is what I learned on Ruan Yifeng Gangster ECMAScript 6 content, send this blog to record my learning content, and to share with you
Note: This is my address to learn, small partners to es6 interested can go to http://es6.ruanyifeng.com