<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb" -->

---
title: How To Use Async/Await in JavaScript | daily.dev
description: Async/await is a new way of writing asynchronous code, besides promises and callbacks. The most significant benefit is that it makes the code more readable and...
canonical: https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How To Use Async/Await in JavaScript | daily.dev
og:description: Async/await is a new way of writing asynchronous code, besides promises and callbacks. The most significant benefit is that it makes the code more readable and...
og:url: https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb
og:image: https://api.daily.dev/og/posts/AVu9DM4jB.png
og:image:alt: How To Use Async/Await in JavaScript
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How To Use Async/Await in JavaScript

**[Hashnode](https://daily.dev/sources/hashnode)** · [@catalinpit](https://daily.dev/catalinpit) · 4 min read · 19 upvotes · 7 comments

## Summary

Async/await is a new way of writing asynchronous code, besides promises and callbacks. The most significant benefit is that it makes the code more readable and cleaner by removing the promise chains. The code snippets below are basic, and they do not handle errors. Their sole purpose is to show the difference between Promises and Async/AWait when using conditionals.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://catalins.tech/how-to-use-asyncawait-in-javascript>

## Community discussion

Top comments from developers on daily.dev.

**@mdzine** · 3 upvotes

> Thanks for a clear explanation of using async/await. Kudos ...

**@catalinpit** · 2 upvotes

> Thank you!

**@nonameme** · 2 upvotes

> not bad

**@peekabo0** · 1 upvotes

> I've realised that promises work like a 'chain of functions' wherein a function calls a function and can pass a value to that function and that function also calls another and so on.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How To Use Async/Await in JavaScript","url":"https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb"},"datePublished":"2020-10-19T07:09:10.626Z","dateModified":"2021-10-07T14:17:10.317Z","description":"Async/await is a new way of writing asynchronous code, besides promises and callbacks. The most significant benefit is that it makes the code more readable and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6db2ca54a3c0c694000baccffb55b788","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6db2ca54a3c0c694000baccffb55b788","isAccessibleForFree":true,"articleSection":"Hashnode","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Catalin Pit","url":"https://daily.dev/catalinpit","image":"https://avatars0.githubusercontent.com/u/25515812?v=4","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":4230}},"commentCount":7,"discussionUrl":"https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":19},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":7}],"keywords":"general-programming,javascript","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hashnode","item":"https://daily.dev/sources/hashnode"},{"@type":"ListItem","position":3,"name":"How To Use Async/Await in JavaScript"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/how-to-use-async-await-in-javascript-avu9dm4jb","comment":[{"@type":"Comment","text":"Thanks for a clear explanation of using async/await. Kudos …","datePublished":"2020-10-19T11:43:33.068Z","url":"https://daily.dev/posts/AVu9DM4jB#c-Y6WjzTh5O","author":{"@type":"Person","name":"Merdan Durdiyev","url":"https://daily.dev/mdzine","image":"https://avatars2.githubusercontent.com/u/8333184?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"Thank you!","datePublished":"2020-10-19T07:13:12.328Z","url":"https://daily.dev/posts/AVu9DM4jB#c-dQdlwwRhC","author":{"@type":"Person","name":"Catalin Pit","url":"https://daily.dev/catalinpit","image":"https://avatars0.githubusercontent.com/u/25515812?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"not bad","datePublished":"2020-10-19T07:13:57.955Z","url":"https://daily.dev/posts/AVu9DM4jB#c-bu2cDzx_D","author":{"@type":"Person","name":"noname","url":"https://daily.dev/nonameme","image":"https://lh5.googleusercontent.com/-LuIBvXw6zgU/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucl_TnVzlNczuHEuXakK_FPQGTn8HQ/s100/photo.jpg"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"I’ve realised that promises work like a ‘chain of functions’ wherein a function calls a function and can pass a value to that function and that function also calls another and so on.","datePublished":"2020-10-19T12:29:29.921Z","url":"https://daily.dev/posts/AVu9DM4jB#c-T3Z1BwbaJ","author":{"@type":"Person","name":"John Bryan Delda","url":"https://daily.dev/peekabo0","image":"https://avatars3.githubusercontent.com/u/7879929?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

