code from chapter 3 in javascript

This commit is contained in:
Kevin Nguyen
2016-06-16 22:37:11 -07:00
parent 09a8115325
commit df2775353a
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
function fact(x) {
if (x === 1) {
return 1;
} else {
return x * fact(x-1);
}
}
console.log(fact(5));