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.
In 'sum' the currentValue is already set to 0 should there be no 'x' or 'y' to add.
While the first if statement is redundant, perhaps it's helpful for readability.
The best thing about this kata is it provides this nice little detail:
"Tested values are all between 0 and 100. Theres is no need to check for negative values or values greater than 100."
So many katas on this site are missing these very useful parameter descriptions.
Is this better though? I'd wonder if it's faster or slower?
And it exists in many programming languages and not just JS.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
If you initialize your reducer to 0 you don't need to check the array length.