factorial by legolandbridge June 12, 2014 JavaScript function factorial(x){ if(x<2){return x;} return x*factorial(x-1); } alert(factorial(4));