Skip to content
Advertisement

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 Promise

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 a

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_present() is to wait till we get

Global memoizing fetch() to prevent multiple of the same request

I have an SPA and for technical reasons I have different elements potentially firing the same fetch() call pretty much at the same time.[1] Rather than going insane trying to prevent multiple unrelated elements to orchestrate loading of elements, I am thinking about creating a gloabalFetch() call where: the init argument is serialised (along with the resource parameter) and used

Advertisement