1
Let’s get to the point:
I would like to create a factorial function using the counter for calculating the factor of the parameter numero.
Remembering that 0! = 1 and 1! = 1.
My code is like this:
function fatorial (numero) {
let num = 1;
for (let i = numero; i > numero; i--) {
num *= num(i);
}
return num;
}
The reasoning must be something simple Nothing too gaudy to run away from this my code.
Error message:
expected 1 to Equal 2
I think this factorial reasoning can help:
n! = n(n-1).(n-2)... 3.2.1
You’re trying to summon
num, which is not a function, but a number.– Luiz Felipe