Tell us what’s happening:
Not sure why, but this is the message I get.
let resultMsg = Factorial of [${num}] is [${factorial}]
console.log(resultMsg);
// running tests
12. Your resultMsg should contain a string in a format Factorial of [num] is [factorial].
// tests completed
// console output
Factorial of [7] is [5040]
Your code so far
let num = 7
function factorialCalculator(n){
let result = 1;
for (let i = 1; i <= n; i++){
result *= i;
}
return result;
}
let factorial = factorialCalculator(num);
let resultMsg = `Factorial of [${num}] is [${factorial}]`
console.log(resultMsg);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0
Challenge Information:
Build a Factorial Calculator - Build a Factorial Calculator