Suppose I have an array, for example:
var arr = [1, 2, 3];
And I have a function:
function f (x, y, z) { ... }
I want to call a function with a given array, where each index of the array is a parameter passed to the function. I could do this:
f(arr[0], arr[1], arr[2]);
But let me not know the length of the array until runtime. Is there any way to do this? Thank!
Mike
source
share