Skip to content

Instantly share code, notes, and snippets.

@yusinto
Created April 6, 2018 00:25
Show Gist options
  • Save yusinto/28295371fc7613f66fab39f0c7435c54 to your computer and use it in GitHub Desktop.
Save yusinto/28295371fc7613f66fab39f0c7435c54 to your computer and use it in GitHub Desktop.
reactjunkie.com promises promises
const p = new Promise(
// this is called the "executor"
(resolve, reject) => {
console.log(1);
resolve(2);
console.log(3);
}
);
console.log(4);
p.then(
// this is called the success handler
result => console.log(result)
);
setTimeout(() => console.log(5), 0);
console.log(6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment