Exercise 8 · Chapter: FunctionsOptional+50 XP
Factorial
Write a function factorial(n) that returns n! (n factorial).
n! = 1 × 2 × 3 × ... × n
Read a number and print its factorial.
Example: Input 5 → Output 120
Need a hint?
3 available · costs 5 XP each
javascript
Output
Run your code to see the output here.