New ES6 features
Welcome to wechat public account [front-end gongcheng House] to share some front-end technology, interview questions, interview skills and so on
Variable declaration:const
和 let
- Compared to the previous
var
No matter where the declaration is, it is considered to be declared at the top of the function let
Represents the declaration of variables, andconst
Represents a declaration constant.- Both are block-level scopes
- Does not have the variable promotion feature, the formation of a temporary dead zone, early access to the variable will report an error
const
Must be assigned when declared
Template string
- String formatting via backquotes, with
The ${}
To implement expression embedding
Arrow function
- Don’t need
function
Keyword to create a function - omit
return
The keyword - Inheriting from the current context
this
The keyword - If the function is a constructor,
this
Pointer to a new object- Function calls in strict mode,
this
Point to theundefined
- If the function is a method of an object, then
this
The pointer points to this object
- Function calls in strict mode,
- There is no
arguments
Object,The remaining parametersIs compared to usingarguments
A better choice of objects - You can’t use
new
Operator that cannot be used as a constructor - There is no
prototype
Properties = >undefined
Class class
- The declaration of a class does not improve if you use a
Class
It must be defined before it is used. - Defining functions in a class is not required
function
The keyword
other
- Parameter Default Value
- Rest operator
.
- Object array deconstruction
for... of
和for... in
for... of
Used to iterate over an iterator, such as a set of numbersfor... in
Used to traverse properties in an object
Hope to read this article you have help, have inspiration, if there is not enough, welcome to criticize the exchange!
Welcome to wechat public account [front-end gongcheng House] to share some front-end technology, interview questions, interview skills and so on
Hard to sort out for a long time, but also hope to manually praise encouragement ~
‘Extract’ is not simply “paste -> copy”, but eye to, hand to, heart to beat down every word.
Statement: all reprinted articles and pictures are only used for the author’s own collection and study purposes. If requested or deemed appropriate, attribution and source will be indicated. If you do not want a work to be re-used, please inform the site in time, the site will be deleted in time.