1, what is ES6? The relationship with JavaScript.
ES is the ECMA (EUROPEAN Computer ManuFactures Association), which is the European computer copy manufacturer attack association. The 100 European Computer Manufacturers Association is an international standard organization for formulating information transmission and communication.
ES = Ecmascript is a dynamic script language [standard];
js = javascript is the standard, default, and mainstream of ES [implementation];
ES This standard was formulated for the JavaScript language from the beginning, but there are two reasons why it is not called JavaScript. The first is the trademark. Java is a trademark of Sun. Only NetScape can legally use the name of JavaScript. And JavaScript itself has been registered as a trademark by NetScape. The second is to reflect that this language maker is ECMA, not Netscape, which is conducive to ensuring the openness and neutrality of this language.
2, VAR, Let, CONST difference
var:
1. Can be repeatedly modified
2. Unlimited modification
3. Function Domain (Global)
let:
1. Can’t repeat the statement
2. Variables (can be modified)
3. Block -level scope (partial)
Note:
①. Try to use VAR as much as possible, give priority to let. VAR is not encapsulated, and it is easy to cover and confuse code.
②Let strictly abide by the order of code, VAR statement variables will ignore the order of the statement
const :
1. Can’t repeat the statement
2. Constant (cannot be modified)
3. Block -level scope (partial)
The value of the
object changes, the address of the object cannot change
3, ES6 Map and Set
Map:
- Value: Object save key value pair. Any value (object or original value) can be used as a key or one value.
- size: Returns the number of key values contained in the Map object
- set (key, value): Add new elements to MAP
- get (key): Find a specific value through the key value and return
- has (key): Determine whether the value corresponding to the key in the Map object is returned to TRUE, otherwise it will return false
- delete (key): Remove the corresponding data from the MAP through the key value
- Clear (): Delete all elements in this map
traversal method:
- keys (): Return to the traverser of the key name
- values (): Return to the traverser of the key value
- ENTRIES (): The traverser of the key value pair of key value pair
- FOREACH (): Use the callback function to traverse each member
Set:
- Value: Object allows you to store any type of value, the only one is not repeated. Whether it is the original value or object reference. Similar values.
- Constructor: Construct a function, the default is the set function.
- size: The total number of members returned to the SET instance.
- Operation method:
- add (value): Add a certain value and return the set structure itself.
- delete (value): Delete a certain value and return a Boolean value, True means that the deletion is successful.
- has (value): Whether the judgment value exists, return to Boolean value.
- clear (); remove all members without returning values.