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

Monday, December 10, 2012

Codeyear: Review: Factorial


//sample solution


// Write a function to get the factorial of a number.
function factorial(int){
//base case
if(int===1){
return 1;
} else {
return int*factorial(int-1);
}
}
//check
console.log(factorial(3));

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts