Attempting to simulate a long running operation using a loop, like this:
var x, y;
x = true;
y = false;
while (x) {
if (!y) {
setTimeout(function() => {
x = false;
}, 1000);
y = true;
}
}
Wondering why the line x = true;
doesn't seem to get executed?