0 points

Factorial


dashboard

Thu Nov 05 2020 11:58:00 GMT+0000 (UTC)

Posted by @snigdhakhurana10

function factorial(num){
	let fact = 1;
    while(num >= 1){
    	fact = fact*num;
        num--;
    }
    return fact;
}
 
console.log(factorial(5));
content_copy Copy