Skip to content

Tag: promise

promise not work as expected misunderstanding?

why the data is not logged and promise is logged in the first code? Answer This is only to demonstrate how you would get the data out of the promise (don’t do it this way): The second code is actually a shortened version of: This is the correct way of chaining Promises. As you can see, we return the Pro…

If statement considers FALSE promise as TRUE

I’m making authentication in my app. And have such code changedPasswordAfter retuns promise (true or false) So I run request and get this into console. As you see ttt is FALSE but IF statement decided that it is TRUE . How can I fix that ? Answer Because ttt (which is a very bad name for a variable) is …

Uncaught in promise while waiting for json response

I’m implementing Promises for the first time in JS and am getting uncaught in promise exception in console log while running the below code. I am handling the result of the promise return value in the main function as below and am yet getting the uncaught in promise message: The logic behind the data_pr…