Panda Quests Posted on Nov 4, 2020 What are the differences between callbacks, promises, async/await? Aren't they essentially the same? #discuss #javascript #typescript Top comments (3) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Collapse Expand shadowtime2000 shadowtime2000 shadowtime2000 Follow If you are looking at this you probably wonder who I am; teenage open source maintainer Education Enough Joined Jul 12, 2020 • Nov 5 '20 Dropdown menu Copy link Hide async/await is essentially easier promises. const foo = async (num) => num + 1; // Is the same as const foo = (num) => Promise.resolve(num + 1); Enter fullscreen mode Exit fullscreen mode With the difference between Promises/async/await and callbacks, callbacks are less readable. Collapse Expand Fernando B 🚀 Fernando B 🚀 Fernando B 🚀 Follow Coding space junkie with a sprinkle of writer heart. DMs open for any questions or comments. 🙂 Location Houston, TX Work Software Engineer at The Fern Joined Oct 21, 2018 • Nov 4 '20 Dropdown menu Copy link Hide They're not the same, promises tried to make callbacks easier to chain. Then async/await tried to make promises even easier, by adding syntactic sugar. Essentially all deal with asynchronous code. Collapse Expand Pankaj Tanwar Pankaj Tanwar Pankaj Tanwar Follow CS Engineer, writer, and creator. Sharing thoughts at https://pankajtanwar.in/blogs Location Jaipur Education MNIT Jaipur Work Software Developer Joined May 20, 2020 • Nov 5 '20 Dropdown menu Copy link Hide dev.to/pankajtanwarbanna/explain-t... Hope it helps. Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
async/await is essentially easier promises.
With the difference between Promises/async/await and callbacks, callbacks are less readable.
They're not the same, promises tried to make callbacks easier to chain. Then async/await tried to make promises even easier, by adding syntactic sugar. Essentially all deal with asynchronous code.
dev.to/pankajtanwarbanna/explain-t...
Hope it helps.