DEV Community

Panda Quests
Panda Quests

Posted on

What are the differences between callbacks, promises, async/await? Aren't they essentially the same?

Top comments (3)

Collapse
 
shadowtime2000 profile image
shadowtime2000

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
 
thefern profile image
Fernando B 🚀

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
 
pankajtanwarbanna profile image
Pankaj Tanwar