Message from JavaScript discussions

August 2018

— I'm just trying to assign to an outer scope variable a inner scope value.

— 

Something like this:

var outer_var;

request.post(..., function (e, r, b) {
outer_var = inner_val;
});

— Yes

— Closures

— For some reason I cannot have this working, running under nodejs

— NodeJS 8.10

— What's the issue you're facing?

— Remember, the callback will only be called when a matching endpoint has been hit

— So until then, outer_var will be undefined

— Yep, it is an async problem i've read that I should use an eventemitter

— Hu

— Hi