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()
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:
So, the poster’s problem can only be output using
onsole.log()