+ 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

2nd Jun 2020, 12:39 AM
Holger Edud Angulo Castillo
Holger Edud Angulo Castillo - avatar
2 ответов
+ 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"});
2nd Jun 2020, 2:31 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Muchas gracias querido emprendedor 👍🏼God bless you
2nd Jun 2020, 2:51 AM
Holger Edud Angulo Castillo
Holger Edud Angulo Castillo - avatar