Although JavaScript ECMAScript 6 is just around the corner, there’re still plenty of developers that are not aware of possibilities given to them in ES5 edition, in terms of arrays-based operations. Let’s go through all seven of them and explain how they work one-by-one.

New ES5 methods


Let’s start with the basics: the forEach method. A few years ago when we wanted to iterate through an array and perform some kind of action, we would probably just use a regular for loop. Something as simple as this:

#protip: V8 and other JS engines nowadays are performing some optimizations on their own, therefore you’d not have to cache array length anymore.

But now, we’re able to simplify it even more and use our forEach method instead: