In JavaScript, the scope goes from outer to inner. This means that variables declared in the outer scope can be accessed in all inner scope, not vice versa. When console.log (sport) was run, it attempted to locate the variable declaration in the favoriteSport function. The external reference point is determined by where your
Table of contents
JavaScript Under The Hood: Advanced Concepts Developers Should KnowThe first thing that happens inside the engineThe Global Execution ContextExecution Context: HoistingExecution context — function invocation and the Call StackExecution Context: Scope ChainJS fascinatingly handles asynchronous tasks!ConclusionBit: Feel the power of component-driven devLearn more7 Comments
Sort: