In JavaScript, we have three types of scope - global, function, and block. You can redefine one with the same name in a different scope, and it won't cause an error. All variables declared with var and all functions declared with the function keyword are pulled to the top of their scope when they’re executed. The engine compiles JavaScript to machine code before executing.

16m read timeFrom alexkondov.com
Post cover image
Table of contents
Table of ContentsScopeVariable Keyword ScopeHoistingHoisting - Proper ExplanationVariable DeclarationVariables Software DesignValues and ReferencesCoercionLogical Operator Return ValuesEqualityClosuresThe ‘this’ KeywordThe ‘new’ keywordUsage of ‘this’ and ‘new’PrototypesClassesCompositionInheritance and PerformancePromisesAsync/AwaitEvent Loop
2 Comments

Sort: