+ 1
Why does 'uncaught (in promise)' appear on the console?
I am doing an exercise using promise in javascript. The result of the exercise displays in the console: uncaught (in promise). When the result of the promise is unfavorable. I want to know if my code is wrong or where I am failing. https://code.sololearn.com/WDW3zYTXjbt4/?ref=app
2 Answers
+ 4
A promises catch block(s) is/are chained to the end of promise or then block etc.
promesa.then((mensaje)=>{document.getElementById("demo").innerHTML="la variable es verdadera"}).catch((mensaje)=>{document.getElementById("demo").innerHTML="la variable es falsa"});
+ 2
Muchas gracias querido emprendedor đđŒGod bless you