Re:“var functionName” vs “function functionName”
by Jare on Wednesday April 30, 2014 @08:12AM
(#7672760)
Are you referring to a case like this?
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.
[ Parent
| on HN ]
There are no comments on this comment yet.