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.
Looks like V8 made some changes and it no longer works (Chrome/Node.js).
But it still works in Firefox
Does it work though? Doesn't in my browser, none of the answers do. I need to use negative 1 to reverse it
I did not know you can use "apply" on a function instead of the spread operator (...arr), TIL.
Gotta understand what "apply" does but it looks helpful
I mean, it works, but its so ugly
This comment is hidden because it contains spoiler information about the solution
The key to this technique is to pass in the Math Object as the first argument instead of null of apply() so that the "this" value is set appropriately. apply(Math, list);
Thanks for the awesome explanation!
Math.min or Math.max doesn't work on arrays, so we borrow it using function method .apply(). You need to pass two things for apply() to work, first is pointer to "this", we don't need it in this example so null, and second is values. Apply allows you to pass values as an array, unlike almost identical call().