Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Factorial function javascript

function getFact(number) {
    let fact = 1;
    for (var i = 1; i <= number; i++) {
        fact = fact * i;
    }
    return fact;
}
console.log(getFact(5))
//Output: 120
 
PREVIOUS NEXT
Tagged: #Factorial #function #javascript
ADD COMMENT
Topic
Name
7+1 =