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.
Such approach occurs once in a thousand or even more solutions in JS... Awesome, many kudos and great respect to author!
+1 for the upper limit.
I like this solution the most.
Is there any reason as to why you would not want to make sure the number coming out is too big?
(Other than an assumed small effect to proformance)
While this solution works for free-standing functions as tested in this Kata, it would fall apart when applied to object methods. Consider this test case:
This would fail with
expected NaN to equal 8
as the solution bindsthis
to the value it had at the time of the call to wrap, rather than torect
at the time of the call of the wrapper.some()
returns a boolean,forEach()
does not return a value. Areturn
can be added as a seccond line.