Build a Factorial Calculator - Build a Factorial Calculator

Tell us what’s happening:

12 registers as incorrect, even though it looks to me like i formatted the string properly, thanks!

Your code so far

let num = 5;
let factorial = '';
function factorialCalculator(num){
  let counter = num-1;
  let result = num;

do{
  result = result * counter;
  console.log(`counter is ${counter}`);
  console.log(result);
  counter--;
} while(counter >= 1);

factorial = result;
let resultMsg = "Factorial of "+ num +" is "+factorial;
console.log(resultMsg) ;
return factorial;
  
}

factorialCalculator(num);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0

Challenge Information:

Build a Factorial Calculator - Build a Factorial Calculator

  1. You should call the factorialCalculator function with num as the argument and assign the result to the variable factorial.

where is the factorial variable with the function call assigned to it?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.