Skip to content

Instantly share code, notes, and snippets.

@Ibro
Created December 22, 2017 12:08
Show Gist options
  • Save Ibro/140f775bab729666a18388215d1a7071 to your computer and use it in GitHub Desktop.
Save Ibro/140f775bab729666a18388215d1a7071 to your computer and use it in GitHub Desktop.
JavaScript Promises, road to async/await - https://codingblast.com/javascript-promise-async-await
function someFunction(value, error) {
return new Promise(
(resolve, reject) => {
if (value) {
resolve(value);
} else {
reject(error);
}
});
}
someFunction('CodingBlast').then((value) => {
console.log(value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment