Last active
August 29, 2015 13:58
-
-
Save kwyn/9959842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f = []; | |
var factorial = function (n) { | |
if (n === 0 || n === 1){ | |
return 1; | |
} | |
if (f[n] > 0){ | |
return f[n]; | |
} | |
f[n] = factorial(n-1) * n; | |
return f[n]; | |
}; | |
factorial(); |
Cool, thanks for that catch! I will get this working correctly. E-mail me when you make changes. I get a flood of e-mails from github so these comments get lost.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Opening quote on line 1 causing parsing error.
Suggested edit:
var f = [];