Hi, everyone. I’m having some trouble with this exercise. This is what I got so far. It’s throwing
syntax errors, so if someone could help me iron some of this out, I’d appreciate it! Thanks!
function factorialize(num) {
if (num === 0) {
return 1;
} else (num < 0) {
return "undefined";
} else (num > 1) {
for (i = num; i > 1; i--) {
return i * (i - 1);
}
}
}
factorialize(5);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15.
else doesn’t need a condition, it’s the falling for when the value didn’t satisfy any of the previous conditions. If you add a condition you need to use else if