Skip to content

Instantly share code, notes, and snippets.

@deleteman
Last active January 4, 2023 13:51
Show Gist options
  • Save deleteman/3e5bb35928be4c1105d349c150fb9918 to your computer and use it in GitHub Desktop.
Save deleteman/3e5bb35928be4c1105d349c150fb9918 to your computer and use it in GitHub Desktop.
const asyncAction = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('Async action completed');
}, 1000);
});
};
asyncAction()
.then(result => console.log(result))
.catch(error => console.error(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment