We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a607b9f commit 5fa89c0Copy full SHA for 5fa89c0
promise.js
@@ -0,0 +1,13 @@
1
+//promise is an object
2
+//so we will make a new instance
3
+const promiseOne = new Promise(function(resolve , reject){
4
+ //Do an async task , DB calls , crptograpgy , network
5
+ setTimeout(function(){
6
+ console.log('Async task is complete');
7
+ resolve();
8
+ }, 1000);
9
+});
10
+//resolve is linked with then but to connect then and resolve we need to call a function called resolve
11
+promiseOne.then(function(){
12
+ console.log("Promise consumed");
13
+})
0 commit comments