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

Function fact

assets/js/calculator.js:36–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36function fact(){
37 var n = forms.display.value;
38 let answer = 1;
39 if (n == 0 || n == 1){
40 answer = 1;
41 }else{
42 for(var i = n; i >= 1; i--){
43 answer = answer * i;
44 }
45
46 }
47
48 forms.display.value = answer;
49}
50
51
52

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected