Ad
Code
Diff
  • factorial=n=>n>1?n*factorial(n-1):1
    • factorial=n=>{for(x=i=1;i<n;)x*=++i;return x}
    • factorial=n=>n>1?n*factorial(n-1):1
Code
Diff
  • const factorial = n => { f=1; while(n--) f*=n+1; return f }
    • factorial=n=>(x=1,[...{*[Symbol.iterator](){for(i=2;i<=n;i++)yield x*=i}}],x)
    • const factorial = n => { f=1; while(n--) f*=n+1; return f }