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.
Yeah, changing an array is almost always a bad idea, but
Array.filter()
doesn't do that: it returns a new array.Using a counter would be a great approach, since it never incurs the overhead of creating a new array. On the other hand,
filter
is parallelizable, so it might end up still being faster in practice!One way to square both approaches would be to use
Array.reduce()
to have a counter and avoid changing the original array.Thanks for the suggestion!