I defined a function that can take any number of arguments but none is required:
function MyFunction() { //can take 0, 1, 1000, 10000, n arguments
//function code
}
Now i would like to write another function that call MyFunction with a variable number of arguments each time:
function Caller(n) {
var simple_var = "abc";
MyFunction() //how can i pass simple_var to MyFunction n times?
}
Thanks in advance 🙂
Function.applycan be used to pass an array of arguments to a function as if each element in the array had been passed as an individual argument:Worth to say, argument length is limited to 65536 on webkit.