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.
In my opinion
-1 for i
-1 for forEach rather than map ( the behavior of map is more verbose than modifying an object and expecting it to be modifed in the original array )
however, i am sure the forEach is more performant, if only marginally.
This is O(N^2). There's an O(N) solution available.
The only part I dislike is the use of 'i' as the variable name. We all know 'i' is used as a loop index but in this case the name should be something more appropriate, for example what the object in question is.
map creates a new array with new items. that is not the goal as I understand it.
What's the main reason to use forEach rather than map here?