I've got a function wich can accept a varible number of parameter with a rest operator.
I want create an object passing the argument collected with the rest operator directly to a constructor without create an object and call an initializing function and without passing the entire array but the parameters ah I do with apply() function.
Is it possible ? Using apply doesn't work.
public function myFunc(...arg) {
// something link "new MyClass.apply(args)"
return new MyClass();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…