Skip to content

Instantly share code, notes, and snippets.

@shahab570
Created January 1, 2021 12:14
Show Gist options
  • Save shahab570/96746fb9ceb8b613ee0eb5a6bc051221 to your computer and use it in GitHub Desktop.
Save shahab570/96746fb9ceb8b613ee0eb5a6bc051221 to your computer and use it in GitHub Desktop.
dd.js
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