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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
John Young and Jordan Heffernan 'In your own words' exercise.
1. What is scope? Your explanation should include the idea of global vs. local scope
Scope is part of the reasoning of how code works in regards to variables. Global scope allows accessing variables everywhere, whereas local scope is bound to the block at which it is defined.
2. Why are global variables avoided?
Global variables are avoided to prevent unintended side effects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is scope? Your explanation should include the idea of global vs. local scope.
Scope determines the level at which variables can be accessed and modified. Scope is determined by the scope chain, which is the
standard for determining the scope of variables.
Local scope refers to the lowest level of the scope chain, and typically refers to block level (ie, inside levels of a function.
Global scope refers to the highest level of the scope chain, and can be accessed across not only the current file, but all files
across the app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters