BACKGROUND
Theoretically, forEach should be optimized now in most browsers, but invoking a method each time is still sometimes more expensive.
BASIC IMPLEMENTATION
Just replace all loops with for or while loops which are faster
VALIDATE
Make sure to do before and after perf checks to see if it's worth it
BACKGROUND
Theoretically, forEach should be optimized now in most browsers, but invoking a method each time is still sometimes more expensive.
BASIC IMPLEMENTATION
Just replace all loops with for or while loops which are faster
VALIDATE
Make sure to do before and after perf checks to see if it's worth it