Created
March 21, 2018 18:03
-
-
Save edujr1/93fa617e5743e0537253eebfac14a625 to your computer and use it in GitHub Desktop.
Exemplo de ordem de execução de uma Promise em JavaScript
This file contains hidden or 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 promessa() { | |
return new Promise(function (resolve, reject) { | |
setTimeout(function () { | |
resolve('PROMESSA CONCLUIDA') | |
}, 5000) | |
}) | |
} | |
var mensagem = promessa(); | |
console.log('Depois do Call da Promise') | |
mensagem.then(function (result) { | |
console.log(result) | |
}) | |
console.log('Depois do .then()') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment