Enquanto a função fatorial do loop em JavaScript

function myfact(number) {
   var fact = 1;
    var i = 1;
    while (i <= number) {
        fact = fact * i;
        i++;
    }
    return fact;
}
console.log(myfact(6));
//Output: 720
Ariful Islam Adil(Code Lover)