Hi all just wondering why the following code results in NaN?
function multiply(num1,num2){
var total = num1 * num2;
return total;
}
var numbers = Array(10,2);
var results = multiply(numbers);
alert (results);
Thanks
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.
You’re only passing one argument to
multiply. Inside the functionnum1is an array andnum2is undefined.What you want to do is this,