MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / factorial

Function factorial

assets/js/FactorialCalculator.js:1–11  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1function factorial () {
2
3 const x = document.getElementById("number").value;
4
5 let fact = 1;
6 for (let i=1; i<=x; i++) {
7 fact = fact * i;
8 }
9
10 document.getElementById("answer").innerHTML = `${x}! = ${fact}`;
11}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected