0
I have the following code:
var age = parseInt(prompt('Digite sua idade: '), 10);
function verificar(age){
return new Promise(function(resolve,reject){
if(age > 18){
resolve()
}else{
reject()
}
})
}
verificar()
.then(
setTimeout(
function(){
console.log('Maior de 18 anos')
},2000
)
)
.catch(
setTimeout(
function(){
console.log('Menor de 18 anos')
},2000
)
)
The problem is that it gives an error in the console and returns 2 strings. How to solve?