|
|
|
|
|
by Jare
4440 days ago
|
|
Are you referring to a case like this? {
f();
var a = 3;
function f() {
console.log(a);
}
}
That will print "undefined" because the entire function f() is hoisted and callable in the first line, but the variable a has not yet been assigned the value. That's not a race condition (those are related to timing in concurrent systems) but is certainly the sort of counter-intuitive visibility that makes me prefer to use function expressions most of the time. |
|