In my application, I have declared an array at the top:
let arr = [1,2,3,4]
There are two methods running in the background.
Method 1
Array.prototype.numberOfCoolElements = function(){
doSomething();
doOtherThings();
// Meanwhile, method2 will be called
return this.length;
}
Method 2
Array.prototype.changeTheLength = function(){
this[100] = 123;
}
If both methods are running asynchronously with the same array reference:
Is it possible for the length of the array to change after numberOfCoolElements
is called and before it finishes?