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.
Yes, slice is retruning just [2,3]. But the thing is the reduce methode dosen't work on that array. In this example the reduce method uses the original arr array. The return value from slice would be the fourth argument in the reduce methode (acc,curr,index,array). Because array has only two elements reduce is called only two times. Thats why it works.
From 1) follows that arr.length is 4 for you example and index max value is 1 because it's the index auf the array that was returned from the slice method. So it can't be NaN.
uses no variables and it's the only solution that would save time making only 1 comparision and returning. if it's lucky it saves 66% time.
when you write it like (a+b<=c & a+c blabla) it will lose time doing all 3 comparisions ... or am I wrong?