Calculate the factorial of a number (n!) using iterative multiplication.
Code
Algorithmsn <= 1 ? 1 : Array.from({ length: n }, (_, i) => i + 1).reduce((a, b) => a * b);Parameters
The number to calculate factorial for
Browser·fetch() may be limited by CORS
More JavaScript Snippets
Binary to Decimal
Convert a binary string representation to its decimal number equivalent.
Bytes to Human Readable
Convert bytes to human readable format (KB, MB, GB, etc.) for file sizes.
Calculate Median
Calculate the median value of an array of numbers.
Calculate Mode
Find the most frequent value(s) in an array.
Calculate Percentile
Calculate the nth percentile of an array using linear interpolation.
Celsius to Fahrenheit
Convert temperature from Celsius to Fahrenheit using the standard formula.