I understand to access a value of a Promise, I will use the "then" callback attach to it.
However, I was wondering how I can affect the context outside of it?
let outsideVar = 0;
promiseA.then(value => {
outsideVar = 1;
})
console.log(outsideVar); //0
As you can see I would like to change outsideVar to 1
[Edit] This question was to see if promises can affect global variables outside of it and if there were any possibilities to do that.
Unfortunately, it is not possible.