MCPcopy Create free account
hub / github.com/Open-Bootcamp/JavaScript-Basico / factorial

Function factorial

sesion-10-modulos/modulos/matematicas.js:13–20  ·  view source on GitHub ↗
(a)

Source from the content-addressed store, hash-verified

11}
12
13function factorial(a) {
14 // Factorial de 5: 5 * 4 * 3 * 2 * 1
15 let factorial = 1;
16 for (let i = 2; i <= a; i++) {
17 factorial *= i;
18 }
19 return factorial;
20}
21
22module.exports = {
23 suma,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected