Message from JavaScript discussions

August 2018

— What do you mean by has?


You're probably logging the outer_var before it gets assigned. JavaScript does not run top to bottom

— Yes, I didn't notice that was an asyncronous function behind the scenes

— I'm wondering on how to store an async calculated token to use it later

— It is supposed to be everything using callbacks with "then" and so on, but sometimes one would like to just say hey, finish those operations and store this information in this instance attribute

Message permanent page

— I know in web applications is full of middlewares but I'm just doing a tiny rest client expecting to be attached to a Telegram API

Message permanent page

— You can store promises of those operations in variables. And when you really need them you can use await in an async function.

Message permanent page

— So async/await will be propagated always, right?

— I dont know what do you mean by propagated

— The return from an async function would always be a promise, if that's what you mean

— So you can store it

— Meaning that in order to use a promise if I do await, I need to be in an async function. Anyway I can also use then

Message permanent page