JSFiddle - React, Tailwind, and code Playground

by dipali_vasani

JavaScript

function factorial(n) {
   return Array.apply(0, Array(n)).reduce(function(x, y, z) {
     return x + x * z;
   }, 1);
 }
 console.log(factorial(0));
 console.log(factorial(5));