I'm just experimenting and came across this:
var d = 7;
var p1 = new Promise((a, b) => {
console.log(p1);
console.log(d);
a('whatever');
});
I'm just curious about what's going on here. The fact that I'm really sure this gonna work, but doesnt, means there's a gap in my understanding. could anyone explain why p1
is not reachable from inside a
, but d
is?
workaround is easy, but I just want to understand this one.
Thanks.