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.
thank you for this comment. My friend told me "you wont be able to do this challenge" so of course I've been trying extra hard not to look at the solutions. I wrote several different permutations but it just seemed impossible to both return the answer AND the reference to the next function. This comment seems to confirm for me that it is indeed impossible to complete this as described. If I understand properly, the solution is to manipulate the prototype of the returned function such that functions which evaluate it see the answer we've stored, but this is something I considered and dismissed as it does not fulfill the instructions as I read them :(
Am i understanding this right?
Good point. This method is new to me. Thanks for the explaination.
Yep, it fails
This comment is hidden because it contains spoiler information about the solution
I only solved the python one but am a JS dev. So out of curiosity does it fail if you do strict comparison using
===
?in fact, the premise of the question is not right
"add(1)(2);
// returns 3"
No. It is not. This returns a function.
In the tests, it is the == operator that does the conversion, as you can read it here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
"If the operands are of different types, try to convert them to the same type before comparing:
When comparing a number to a string, try to convert the string to a numeric value.
I was heading towards this solution, but I didn't finish...
Great clever work!
Great joke though!