Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2017 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c905c93c9cd44ff08b64b6f28535bf95 to your computer and use it in GitHub Desktop.
Save anonymous/c905c93c9cd44ff08b64b6f28535bf95 to your computer and use it in GitHub Desktop.
let Promise created by leodotng - https://repl.it/K9Di/2
// Here is the video https://www.youtube.com/watch?v=490Hhpqaho4
let promise = new Promise((resolve, reject) => {
//always put resolve and reject in there
let value = true;
setTimeout(() => {
if (value) {
resolve('this value is true!');
} else {
reject('This value is not true.');
}
}, 3000);
});
promise.then(
resolved => console.log(resolved),
error => console.error(error)
);
Copy link

ghost commented Aug 31, 2017

Javascript Promises video: https://www.youtube.com/watch?v=490Hhpqaho4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment