function f1(i1, i2) {
log(i1);
log(i2);
}
function f2(i1,i2){
f1(arguments);
}
f2(100,200);
In the above case in function f1 i1 gets [100, 200] while i2 is undefined.
What is the correct way to pass arguments to f1 from f2.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Function objects have an
apply()method:The first parameter passed is the object that should be
thisin the called function, the second parameter is an array containing the parameter values for the called function.