Skip to content

Instantly share code, notes, and snippets.

@marcosrivasr
Created September 2, 2019 20:31
Show Gist options
  • Save marcosrivasr/131bfdca247e6f40645b2680851316cc to your computer and use it in GitHub Desktop.
Save marcosrivasr/131bfdca247e6f40645b2680851316cc to your computer and use it in GitHub Desktop.
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