You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What information was incorrect, unhelpful, or incomplete?
"it generally runs it in order, from top to bottom"
"you need to be careful that the objects referenced in your code exist before you try to do stuff to them."
What did you expect to see?
Clearly this is true, that "I have to be careful." Text order isn't the rule, however. ("Generally" is the wiggle word, I guess.) Right in front of me here is a counter example. The code references updateName before the function is defined. Why does that work? The reason uncovers that the ordering is more subtle than simply text, "top to bottom" order.
Do you have any supporting links, references, or citations?
no
Do you have anything more you want to share?
I don't know how to improve this without going too deeply too quickly. Maybe put it in terms of definition before evaluation and noting that button is evaluated by the browser immediately when encountering it in the text?
MDN URL
https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/What_is_JavaScript
What specific section or headline is this issue about?
https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/What_is_JavaScript#javascript_running_order
What information was incorrect, unhelpful, or incomplete?
"it generally runs it in order, from top to bottom"
"you need to be careful that the objects referenced in your code exist before you try to do stuff to them."
What did you expect to see?
Clearly this is true, that "I have to be careful." Text order isn't the rule, however. ("Generally" is the wiggle word, I guess.) Right in front of me here is a counter example. The code references
updateName
before the function is defined. Why does that work? The reason uncovers that the ordering is more subtle than simply text, "top to bottom" order.Do you have any supporting links, references, or citations?
no
Do you have anything more you want to share?
I don't know how to improve this without going too deeply too quickly. Maybe put it in terms of definition before evaluation and noting that
button
is evaluated by the browser immediately when encountering it in the text?MDN metadata
Page report details
en-us/learn_web_development/core/scripting/what_is_javascript
The text was updated successfully, but these errors were encountered: