Promises in ES6

Promises are usually vaguely defined as “a proxy for a value that will eventually become available”. They can be used for both synchronous and asynchronous code flows, although they make asynchronous flows easier to reason about – once you’ve mastered promises, that is. Consider as an example the upcoming fetch API. This API is a […]

Continue reading →

Generators in ES6

Generators are a new feature in ES6. You declare a generator function which returns generator objects g that can then be iterated using any of Array.from(g), […g], or for value of g loops. Generator functions allow you to declare a special kind of iterator. These iterators can suspend execution while retaining their context. Here is […]

Continue reading →

Iterators in ES6

JavaScript gets two new protocols in ES6, Iterators and Iterables. In plain terms, you can think of protocols as conventions. As long as you follow a determined convention in the language, you get a side-effect. The iterable protocol allows you to define the behavior when JavaScript objects are being iterated. The code below is an […]

Continue reading →

Symbols in ES6

Symbols are a new primitive type in ES6. If you ask me, they’re an awful lot like strings. Just like with numbers and strings, symbols also come with their accompanying Symbol wrapper object. We can create our own Symbols. var mystery = Symbol() Note that there was no new. The new operator even throws a […]

Continue reading →

Arrow Functions in ES6

Arrow functions are available to many other modern languages and was one of the features I sorely missed a few years ago when I moved from C# to JavaScript. Fortunately, they’re now part of ES6 and thus available to us in JavaScript. The syntax is quite expressive. We already had anonymous functions, but sometimes it’s […]

Continue reading →

Permissions API for Web

Till now, when you land on a site that needs your location, Chrome immediately pops up a little request at the top of the browser window, even though you may not even really know what the site is all about. Now, as a developer, if you’ve worked with the Geolocation API before, chances are you’ve wanted to check if […]

Continue reading →