Created
August 31, 2017 00:13
-
-
Save anonymous/c905c93c9cd44ff08b64b6f28535bf95 to your computer and use it in GitHub Desktop.
let Promise created by leodotng - https://repl.it/K9Di/2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Javascript Promises video: https://www.youtube.com/watch?v=490Hhpqaho4