Skip to content

Instantly share code, notes, and snippets.

@marcelomf
Last active January 16, 2019 11:50
Show Gist options
  • Save marcelomf/f9e1cb93f13382b50e23f864382e9c3a to your computer and use it in GitHub Desktop.
Save marcelomf/f9e1cb93f13382b50e23f864382e9c3a to your computer and use it in GitHub Desktop.
Teste
const funcao1 = function(id){
return {nome: "João", idade: 32, id: id}
}
const funcao2 = function(callback, id){
setTimeout(function(){
return callback({nome: "João", idade: 32, id: id})
}, 3000)
}
const funcao3 = (id) => {
var p = new Promise(function(resolve, reject){
setTimeout(function(){
resolve({nome: "João", idade: 32, id: id})
}, 6000);
});
return p
}
async function main() {
funcao2(function(dados){
console.log(dados)
}, 3);
console.log(await funcao3(1))
console.log(funcao3())
funcao3(2)
.then(function(dados){
console.log(dados)
});
console.log(funcao1(0))
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment