ES6 standards and support

 
 
Browser support for various new features: https://kangax.github.io/compat-table/es6/
 
Each node support for the new version features: http://node.green/
 
Symbol.iterator
Returns a visitor object, which itself is an expression.
arr[Symbol.iterator]();
 
Strings, arrays, map, set all realized Iterator interface
 
 
Map and Object differences:
Map provides a structure - corresponds to the "value", is a better structure to achieve Hash. If you need a data structure "key pair", Map more appropriate than Object. It is similar to the object, but also a set of key-value pairs, but the scope of the "key" is not limited to character string, various kinds of values ​​(including objects) can be used as keys.
Note that only a reference to the same object, Map structure before it as the same key. This is to be very careful.
Copy the code Copy the code
var map = new Map ();
 
map.set(['a'], 555);
map.get(['a']) // undefined
get and set methods in the code above, the surface is a key for the same, but in fact it is two values, the memory address is not the same, and therefore the key can not read the get method, returns undefined.
If the key is a value Map (numbers, strings, Boolean) a simple type, as long as the two values ​​are exactly equal, Map it as a key, and including 0 -0. In addition, although not strictly equivalent to NaN itself, but Map it as the same key.
 

Guess you like

Origin www.cnblogs.com/wanglao/p/11162825.html