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.
Just did a benchmark myself, looping over 10.000.000 array-entries:
From what i read, the
forEach
was drastically slower in previous node-versions. But since year or so at least, it is now on an equal level. But seems that, if you want performance, you should use the standard for-loop, because it's just way faster.But i also understand your opinion on the pure function part.
I wouldn't agree with their opinion. To me dealing with pure functions that return values is easier. The advantages of using custom for loops over forEach however is that you can use arbitrary control structures (return, break, continue, yield, await) in the loop body.
Same solution as mine, but to add the missing 1%:
directionValues
the possible keysn, s, w, e
.forEach
.There are several people out there who say that
forEach
is bad, but i didn't verify any of those.