This content has been marked as final. Show 5 replies
The first function receives 5 items in the args collection.
The second function receives 1 item in the args collection. But if you look
at the type of args, you'll see that it's an array -- not a string.
You should use Function.apply() to forward the ... rest
i don't see a problem. what is it that you think is going astray?
p.s. args in SecondFunction is an array containing one element (which is itself an array).
p.p.s. i don't see anything calling SecondFunctionRevisted().
Ok. Just look at FirstFunction and Second Function.
The params passed to FirstFunction are successfully wrapped into an array. Exactly what the ... rest param declaration is supposed to do.
However, when it gets passed to SecondFunction, it gets converted to a string. It should be passed as the assembled array. Unless, maybe it is making the array yet another array and to retrieve my originally passed params in the second function I would have to trace args.length
I just tried that and that is what it is doing, it keeps compounding the array. So, I guess no bug after all. Just me being stupid.
correct. it's doing exactly what it should be doing.
args in SecondFunction is an array containing one element (which is itself an array).