📜  使用 javascript 堆栈溢出的阶乘 - Javascript 代码示例

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

代码示例2
let myArray = [];

function calculateFactorial (myFacNumber)
{
  
   let result = 1;
   let c; 

  for(let x = 1; x<=myFacNumber; x++)
  {
     for(let j = x; j<=x;j++)
     {
       c= myArray[j] = x;
       result *= c;
     }
  }
 return result; 
}
console.log(calculateFactorial(5));