O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit 7. Working asynchronously

JavaScript has always been an asynchronous language. That makes it a perfect language for creating rich applications, because it can handle many concurrent tasks without locking the interface. But until recently, there hasn’t been much first-class support for its asynchronous nature other than being able to pass around functions that can be invoked at a later time. That has all changed. JavaScript now has first-class support for promises, asynchronous functions, and soon, for observables.

Promises are objects that represent future values. They are more convenient to pass around than callbacks because, unlike callbacks, they don’t rely on timing. A promise will give a value right away if the value has already been ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required