Recap - Factorial
Part of the Fundamentals section of Coddy's JavaScript journey — lesson 42 of 77.
Challenge
BeginnerFactorial is a mathematical operation. Factorial of n is the product of all positive integers less than or equal to n. For example:
- Factorial of 3 is 6, which can be calculated as 1 * 2 * 3
- Factorial of 6 is 720, which can be calculated as 1 * 2 * 3 * 4 * 5 * 6
- Factorial of 2 is 2, which can be calculated as 1 * 2
Write a program that receives one input (given), an integer, calculates the factorial of the input and prints it.
For example, for input 5, the output should be 120 because 1 * 2 * 3 * 4 * 5 = 120.
Try it yourself
let n = parseInt(inp); // Don't change this line
All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Type Coercion7Bill Split Calculator
Welcome MessageCalculating The Tip And Total2Variables
NumbersStringBooleanNaming ConventionsEmpty VariablesRecap - Initialize VariablesConstants3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsComparison OperatorsStrict vs Loose EqualityRecap - Simple Math6Basic IO
OutputOutput with VariablesType Conversion - Part 1Type Conversion - Part 2Recap - Till 120Recap - True or False