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.
I guess I'm far too late but still will reply for future reader.
The first argument to the reduce callback is "accumulator" which is a variable that is what was returned from the function on the previous run.
If it's the first run of the function then accumulator will contain a first element of the array or the user specified value.
For example we can sum everything in array via [1,2,3].reduce((a,x) => a+x) //this uses a fat arrow syntax, that is left as an excercise to the reader
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
We don't want to return the result of the
splice
but the value ofe
after the splice.See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator
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