I’m working on the Factorialize a Number challenge. I decided to start working with node js so I could see more run results than just that last line that FCC offers. The code I came up with produces the right numbers in node js, but FCC tells me I’m not returning a number:
var factor=1;
function factorialize(num) {
if (num==0) {
console.log(factor);
return factor;} else {
factor=factor*num;
factorialize(num-1);}
}
factorialize(5);
What am I missing? I figure I must be missing something because I needed the console.log(factor) to get a printout from node js. If I leave it at return factor;
I don’t get numbers in node js either. But then code that will correctly return a value in FCC like:
return("hello world");
don’t work for me in node.js either. I’ve looked up documentation on return and on node js and still can’t figure out what this code is unacceptable to FCC. Thanks for any light you can shine my way.