Created
January 1, 2021 12:14
-
-
Save shahab570/96746fb9ceb8b613ee0eb5a6bc051221 to your computer and use it in GitHub Desktop.
dd.js
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
const new_car = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve("This is the car.Enjoy!!!"); | |
}, 3000); | |
}); | |
new_car.then( | |
(value) => { | |
alert(value); //ths code runs because promise resolves | |
}, | |
(error) => { | |
alert(error); //it doesn't run | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment