# What do you mean shorthand notation in the function?

I have a function factorial
``````function factorial(n) {
return (n < 2) ? 1 : factorial(n - 1) * n;
}``````

what do you mean this entry: factorial(n - 1)? As it is differently written?

Thanks to all, understood)
April 19th 20 at 12:49
April 19th 20 at 12:51
Solution
This recursion under certain conditions.
How to write it differently? - Jana26 commented on April 19th 20 at 12:54
@Misty_Bernhard83, why? - Toni.Ullrich29 commented on April 19th 20 at 12:57
@erich16to understand how it works - Jana26 commented on April 19th 20 at 13:00
@Misty_Bernhard83to understand how this works, we must first understand what is the factorial, as it is in mathematics. - Toni.Ullrich29 commented on April 19th 20 at 13:03
April 19th 20 at 12:53
As already said, this is recursion, it is possible to write something like this.
``````function factorial(n) {
let f = 1;

for (var i = 2; i <= n; i++) {
f *= i;
}

return f;
}``````

Find more questions by tags JavaScript