📜  javascript代码示例中的阶乘while循环反转

📅  最后修改于: 2022-03-11 15:02:22.585000             🧑  作者: Mango

代码示例1
function myFactorial(number) {
    var fact = 1;
    var i = number;
    while (i >= 1) {
        fact = fact * i;
        i--;
    }
    return fact;
}
console.log(myFactorial(6));
//Output: 720;