Created
August 2, 2021 17:36
-
-
Save malikperang/85d7ab0c617ed156bda6c7eed9aea9cc to your computer and use it in GitHub Desktop.
JS promise
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
function abc() { | |
var promise = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve('step 1'); | |
}, 1000); | |
}); | |
return promise; | |
} | |
async function def(){ | |
await abc().then((data) => { | |
console.log(data); | |
console.log('step 2'); | |
}) | |
} | |
def(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment