Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You're correct. The other comments bring up tail recursion, which would deal with this issue, but they conveniently leave out the fact that almost no JavaScript runtime actually supports it.
I'm in shock :0
This comment is hidden because it contains spoiler information about the solution
While you are right, the "stack problem" can be dealt by adding an accumulator:
GetSumHelper(a, b, acc)
For more info: http://stackoverflow.com/questions/33923/what-is-tail-recursion#37010
While undoubtedly clever, I don't get why this has votes for best practice. As a and b get farther apart, the stack gets unnecessarily large.
Love it!
this is cool!!!
Very good hint! Thanks!
Omg this is cool
this is great, wish i had thought of it
You have to call it like
rather than
The documentation is a bit unclear
a test case is using expectError and I'm throwing an error and it shows on the output that I have thrown an error but the test case is still not regarded as a success. Am I doing something wrong? Shouldn't I throw an error?