A few days ago ECMAScript 2015, also known as ECMAScript 6 or ES6, has been finalized. Even if this event happened very recently, there are already a number of features supported in the latest versions of Chrome, Firefox, Safari, and Opera. If you're really itching for the ES6 goodness, you can even use a number of well-supported transpilers right now.
Two of the new features, generators and iterators, are set to change some of the ways we write specific functions when it comes to some more complex front-end code. While they do play nicely with one another, what they actually do can be a little confusing to some, so let's check them out.
Iterators
Iteration is a common practice in programming and is usually used to loop over a set of values, either transforming each value, or using or saving it in some way for later.
In JavaScript we've always had for loops that look like this:
Continue reading %ECMAScript 2015: Generators and Iterators%
by Byron Houwens via SitePoint
No comments:
Post a Comment