Factorialize a Number and my code work perfectly but freecodecamp run test show error

function factorialize(num) {
  let result = 1;
  for(let i = 1;i<=num;i++){
     result *= i;
  }
  console.log(result);
}

factorialize(5);

my code work perfectly. So,why freecodecamp show an error when I run test. Please someone tell me where I did wrong

Probably need to return the result, not just log it to the console.

thanks it’s worked. :smiley:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums