Skip to main content

Command Palette

Search for a command to run...

Async..await is syntactic sugar on Promises

Published
1 min readView as Markdown
const getData = () => {
  return new Promise((resolve) => {
    resolve("Hello World");
  });
};

getData().then((result) => console.log(result));

// is same as

const main = async () => {
  const result = await getData();
  console.log(result);
};
main();

More from this blog

Codedrops.tech

49 posts