javascript - JS extended statement usage
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-06-28 09:27:08
0
2
589

Why does directly entering ...a result in an error

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
巴扎黑

According to the es6 standard, it can only be used when passing parameters

滿天的星座

It seems that the remainder/expand operator does not support this use. Currently, the scenarios where I have used the remainder/expand operator in practice include:

// 函数形参
function f(x,y,...z){};
f(1,2,3,4,5); //f()内:z=[3,4,5]
// 函数实参
var a = [1,2,3];
function f(w,x,y,z){};
f(1,...a); //f(1,1,2,3)
// 数组字面量
var a = [1,2,3];
var b = [...a,4]; //b=[1,2,3,4]

So, the poster’s problem can only be output using onsole.log()

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template