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.
If you omit the initialValue, then the initial value of the sum will not be 0, but the first element.
why?
wrong
Using an initial value is unnecessarry since it's zero.
This leads to an extra circle through the array which is not needed here.
If you omit the initial value you will therefore save one circle.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#how_reduce_works_without_an_initial_value
Yeah you are right. Edited solution to pass that case.
What if array1 = [0] and array2 = [0] ? This solution returns []. I think it should still return [0].
Empty array should only be returned if both arrays are empty.