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.
sum
is not an array, but a function. Because it's called twice on each comparison during sorting, you may end up with some numbers having their sum calculated multiple times.Why? As I understand it, the sums for each number are only calculated once. During the compare the sum array is only referenced.
take a five, bruh :D
What is sumA === sumB ? Does it means each signle string number equal ?
It is indeficent, it will do the sum several times per each number
I don't like using both declarations and expressions for functions.
The callback you pass into reduce can do everything, including parseInt
oooohhhh very nice. I feel terrible now hahahaha
Love it!
I know it's a while now, but for whoever is also wondering:
I believe it's just a matter of preference using
const
arrow-functions for one-liners andfunction
for longer functions.Never knew that reduce works as a int parser, could be one line less for me :-)
Nice one
Wow, talk about leveraging functional programming to the fullest!
Very impressed/confused. Thank you all for the valuable lesson.
Why have sum be a const and then comp be a function? Couldn't they both be constants?
Loading more items...