Created
September 2, 2019 20:31
-
-
Save marcosrivasr/131bfdca247e6f40645b2680851316cc to your computer and use it in GitHub Desktop.
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
const p = new Promise((resolve, reject) =>{ | |
let x = 10; | |
if(x == 10){ | |
resolve('El valor de la variable es 10'); | |
}else{ | |
reject('Error: falló la validación'); | |
} | |
}); | |
p | |
.then(res =>{ | |
console.log(res); | |
}); | |
.catch(error =>{ | |
console.error(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment