Overall a good summary, but I take issue with your calling conventional loops a "beginner" technique because in most cases they're FASTER than the alternatives such as the 100% derpy "forEach".

You also omitted or missed that for loops can use assignment as a condition, and it CAN be far faster so long as you know no values are loose false.

var example = ['10', '20', '50', '64', '76'];
for (var i = 0, value; value = example[i]; i++) console.log(value);

Remember, anyplace you can use a condition, you can perform an assignment. The above being a great substitute for “for/of” in cases where more modern scripting techniques are unavailable. (aka client-side) and is in many cases in some browsers faster. Particularly the more you use the value inside the loop. Remember, array lookups are slow, so the less of them you do, the better.

Can be REALLY fast with nodeLists and other non-array iterables, since being a list of objects they’d be passed by reference, unlike strings where the entire value has to be copied.

But seriously, forEach is so painfully inefficient since it adds the overhead of “functions for nothing” to so many codebase. This is only made worse by the dumbass painfully and uselessly cryptic arrow function trash.

I was going to put up a couple JSPerfs, but it looks like they’ve gotten shut down by NPM f***wittery in the form of Zeit being upgraded without them updating the site to match.

Just part of why I think NPM and the “node ecosystem” is equally dumbass trash. No matter how many know-nothing “copypasta fanboys” sing its praises.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store