Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Six reasons why JavaScript’s async/await blows promises away

In the JavaScript world promises are a great way to deal with stuff that needs to happen asynchronously. But there’s also another new way to go about it: async/await.

In case you missed it, Node now supports async/await out of the box since version 7.6. If you haven’t tried it yet, here are a bunch of reasons with examples why you should adopt it immediately and never look back.

For those who have never heard of this topic before, here’s a quick intro
– Async/await is a new way to write asynchronous code. Previous options for asynchronous code are callbacks and promises.
– Async/await is actually built on top of promises. It cannot be used with plain callbacks or node callbacks.
– Async/await is, like promises, non blocking.
– Async/await makes asynchronous code look and behave a little more like synchronous code. This is where all its power lies.

https://hackernoon.com/6-reasons-why-javascripts-async-await-blows-promises-away-tutorial-c7ec10518dd9

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.