What is the correct way to wait for a response in a promise?
-
DD, help please how to perform such an action: there is a certain variable that at the moment of initialization has the value undefined, how to wait with the help of a promise when the value will be! = Undefined and after that execute the block instruction
.then (), maybe I misunderstood the promiseJavaScript Ava Foley, Jan 16, 2019 -
Generally misunderstood. Promises are commonly used with asynchronous functions and their job is to get ANY response from them. And this answer can be either number / string / array / object, etc., or undefined, null, etc.
Observers are worth looking at for tracking variables.
https://developer.mozilla.org/en/docs / Web / JavaScri ...
I do not know any other options to monitor the variable (if you do not take into account the Timeout set, but it is).Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!