-
Notifications
You must be signed in to change notification settings - Fork 33.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ch 4 Functions First is a little confusing #63
Comments
I think the proper way to think about it is: functions are hoisted first and then variables, but a function execution (as with any other sort of statement) always happens after both have been declared, which means that a function referencing a variable will find it by the time the function is executed. |
OK, I guess it is a fairly minor distinction anyway. Keep up the great work! |
Thanks! :) |
But what is happened in there? If functions are hoisted first and then variables we can't call foo like function but we can |
|
You state that functions are hoisted before variables, and yet these functions can refer to variables defined in the same scope. Is it simply the case that the variables will be defined by the time the function is actually called, or is it that all the variable and function names are hoisted together, then the functions defined, and then the remainder of the code executed?
The text was updated successfully, but these errors were encountered: