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.
Got it, thanks!!
filter
method for arrays receives up to 3 arguments (in the following order)element, index, array
and returns a filtered array in which the function passed in returnstrue
=>
denotes an arrow function, introduced in ES6, the newest specification for Javascript to date. The behaviour and usage of arrow functions is nearly identical to that of ordinary functions - the notations can be used interchangeably 99% of the time...
adds all the items in a specified list (e.g. function arguments, an array or even a string) into an array.Hope this helps :)
Could you explain how this line works?
copy = [...copy.filter((a,b)=>b>0), ...copy.filter((a,b)=>b==0)];
Thanks!