Here is the script, I don’t understand why it doesn’t work…
function FirstFactorial(num) {
var lower = num - 1;
var qq = 0;
while (num > 0) {
var qq === num * lower;
num--;
lower--;
}
num === qq;
return num;
}
FirstFactorial(num);
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 have quite a few issues with this function, see the comments.
Even with these syntactical fixes, your logic for calculating factorial is not correct.
Edit: working examples (because I was bored) http://jsfiddle.net/gU2cz/