Basic Algorithm Scripting: Factorialize a Number (Console.log Question)


I was just wondering why console.log() isn’t working for me after I return num after the else statement. Does that mean num isn’t returning anything? And if it’s not, is it stuck in an infinite loop? Thanks!

Your code so far

function factorialize(num) {
if (num == 0 || 1){
  return 1;
  return num = (factorialize(num-1))+1(num);


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.

Challenge: Factorialize a Number

Link to the challenge:

That console log is after the the function return. Function execution stops once the function hits a return statement.

1 Like

I see! Thank you very much!

1 Like