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.
This comment is hidden because it contains spoiler information about the solution
That is actually pretty clever.
map is a sugar of reduce~
what a map
mind to explain a bit?
Nice because it's also readable.
Interesting solution
Nice! I have a similar solution using reduce, but this is even easier.
No early return by using
map
if it finds the missing number.There're some comments about
forEach
, it doesn't early return, too.A really clever solution. One downside is that there is no early return, meaning that it will loop over every single value in what could be a very large array, even if a missing number has already been identified.
Yes,
forEach
would be more appropriate in this instance as the iteration doesn't need to return anything.I did mine like in the top rated example but I like this more.
for
is more suitable I think.