How to use the ES6 extension operator
Most people do not understand the knowledge points of this article "how to use the ES6 extension operator", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use the ES6 extension operator" article.
What are the spread and rest operators
In ES6, both the spread and rest operators use (...) Where spread is the expansion (expansion) operator and rest is the residual (collection) operator. Using this operator in different places has different functions, which can be considered from both reading and writing perspectives. Among them, the write operation has the collection function, and the read operation has the expansion function. In ES6, (...) Operators are valid only for arrays, and extensions to objects have been added to ES7.
Extension operator of array
Rest operator (collection effect)
Use (.) when not available. Operator, you can only use arguments if you want to implement a summation function with variable arguments. For example:
Function sum () {let sumNumber=0; for (let iTuno witi)