That is false except for the case that x is a global variable, no outside function can change the value of x, only in-scope procedures can do that.
In the end this shows that JS is unequipped to handle such behavior without significant changes to the core language.
Then even in a synchronous context you'd have no guarantee that it wouldn't be modified:
function soSomethingSync() {
window.someObj.someProp = 12;
}
let x = window.someObj;
soSomethingSync();
console.log(x)
This has nothing whatsoever to do with sync vs async.It is one of the main reasons people like immutability/functional programming. But that's its own topic.
Its a fundamental concurrency pattern used in a lot of languages, often for UI threads and such. There's a lot of information on this topic and it certainly is about async/yielding.