My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Async function in JavaScript.

Async function in JavaScript.

Ravindra Singh Shah's photo
Ravindra Singh Shah
·Dec 6, 2017

Without blocking main thread you can write code like Promise (as it's synchronous).

What I like about async function is that it's more readable, especially for those who are not much familiar with Promises.

Here is small example of same in JsFiddle with difference in Promise and Async function.

Needless to say but, this is supported in the newer versions of browsers.