Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, December 9, 2012

Codecademy: Codeyear Factorial


//sample solution


function factorial(n) {
  if (n === 0) {
    return 1;
  }
 
  // This is it! Recursion!!
  return n * factorial(n - 1);
}

factorial(10);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts