I have a function which is like this (but with more parameters):
function do_something(n1, n2, n3){
return((n1-n2)*n3);
}
And then I have an array which contains 3 items, and are the parameters of that function:
my_array = [10,123,14];
For example,
do_something(my_array[0], my_array[1], my_array[2]);
The following is probably not valid code for JavaScript but I want something like this,
do_something(for(var i = 0; i < my_array.length; i++){
add_parameter(my_array[i]);
});
So, is there any efficient way to make the elements of the array the parameters of function?