This file contains hidden or 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
| // This gist contains the JavaScript version of the code from the blog post | |
| // https://hurryabit.github.io/blog/stack-safety-for-free/ | |
| function triangular(n) { | |
| if (n == 0) { | |
| return 0; | |
| } else { | |
| return n + triangular(n - 1); | |
| } | |
| } |
OlderNewer