【Spread Syntax】
The spread syntax allows an expression to be expanded in places where multiple arguments are expected.

1、为了将[]传递给一个函数,过去使用apply方法

ES2015后,可以使用spread语法:

一个更复杂的例子

2、一个array组合另一个array

3、连接两个array。
过去这么干:

现在可以这么干:

4、unshift.
过去:

现在:

Note that the spread operator can be applied only to iterable objects:
参考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator
浙公网安备 33010602011771号