javascript – Why is my variable unaltered after I modify it inside of a function? – Asynchronous code reference
Questions: Given the following examples, why is outerScopeVar undefined in all cases? var outerScopeVar; var img = document.createElement('img'); img.onload = function() { outerScopeVar = this.width; ...