Top "Promise" questions

Promises are a tactic for deferred computing, suitable for several styles of concurrency: thread and event loop concurrency for local computation, and both synchronous and asynchronous remote messaging.

Using async/await with a forEach loop

Are there any issues with using async/await in a forEach loop? I'm trying to loop through an array of …

javascript node.js promise async-await ecmascript-2017
What is the difference between Promises and Observables?

What is the difference between Promise and Observable in Angular? An example on each would be helpful in understanding both …

angular promise rxjs angular-promise angular-observable
Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai

So, I'm testing a component that relies on an event-emitter. To do so I came up with a solution using …

javascript node.js promise mocha chai
How do I wait for a promise to finish before returning the variable of a function?

I'm still struggling with promises, but making some progress thanks to the community here. I have a simple JS function …

javascript parse-platform promise
How to access the value of a promise?

I'm looking at this example from Angular's docs for $q but I think this probably applies to promises in general. …

javascript angularjs promise angular-promise
Syntax for async arrow function

I can mark a javascript function as "async" (i.e. returning a promise) with the async keyword. Like this: async …

javascript promise async-await arrow-functions
TypeError: Cannot read property 'then' of undefined

loginService.islogged() Above function return a string like "failed". However, when I try to run then function on it, it …

javascript angularjs promise
jQuery deferreds and promises - .then() vs .done()

I've been reading about jQuery deferreds and promises and I can't see the difference between using .then() & .done() for …

jquery promise jquery-deferred
Why is my asynchronous function returning Promise { <pending> } instead of a value?

My code: let AuthUser = data => { return google.login(data.username, data.password).then(token => { return token } ) } And when …

javascript node.js promise
How to wait for a JavaScript Promise to resolve before resuming function?

I'm doing some unit testing. The test framework loads a page into an iFrame and then runs assertions against that …

javascript asynchronous promise