Skip to content

Commit

Permalink
promise Ex 1
Browse files Browse the repository at this point in the history
  • Loading branch information
codingXpert committed Jun 26, 2022
1 parent fcb84e9 commit c7a7aad
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions promises1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let a = 10;
let b = 0;
let waitingData = new Promise((resolve, reject) => {

setTimeout(() => {
resolve(30);
}, 2000);
});

waitingData.then((data) => {
b = data;
console.log(a + b);
});

waitingData.catch((err) => {
console.log('Some Error Occured:-' , err);
});

0 comments on commit c7a7aad

Please sign in to comment.