@@ -73,7 +73,7 @@ unless the *desired effect* is to affect the outer scope.
7373### Local Variables
7474
7575The only source for local variables in JavaScript are
76- [ function] ( #function.general ) parameters and variables that were declared via the
76+ [ function] ( #function.general ) parameters and variables declared via the
7777` var ` statement.
7878
7979 // global scope
@@ -115,8 +115,8 @@ JavaScript **hoists** declarations. This means that both `var` statements and
115115 }
116116 }
117117
118- The above code gets transformed before any execution is started . JavaScript moves
119- the ` var ` statements, as well as the ` function ` declarations to the top of the
118+ The above code gets transformed before execution starts . JavaScript moves
119+ the ` var ` statements, as well as ` function ` declarations, to the top of the
120120nearest surrounding scope.
121121
122122 // var statements got moved here
@@ -150,15 +150,15 @@ In the original code, although the `if` statement seemed to modify the *global
150150variable* ` goo ` , it actually modifies the * local variable* - after hoisting
151151has been applied.
152152
153- Without the knowledge about * hoisting* , the below code might seem to raise a
153+ Without knowledge of * hoisting* , one might suspect the code below would raise a
154154` ReferenceError ` .
155155
156156 // check whether SomeImportantThing has been initialized
157157 if (!SomeImportantThing) {
158158 var SomeImportantThing = {};
159159 }
160160
161- But of course, the above works due to the fact that the ` var ` statement is being
161+ But of course, this works due to the fact that the ` var ` statement is being
162162moved to the top of the * global scope* .
163163
164164 var SomeImportantThing;
@@ -176,10 +176,10 @@ All scopes in JavaScript, including the *global scope*, have the special name
176176[ ` this ` ] ( #function.this ) , defined in them, which refers to the * current object* .
177177
178178Function scopes also have the name [ ` arguments ` ] ( #function.arguments ) , defined in
179- them, which contains the arguments that were passed to a function.
179+ them, which contains the arguments that were passed to the function.
180180
181181For example, when trying to access a variable named ` foo ` inside the scope of a
182- function, JavaScript will lookup the name in the following order:
182+ function, JavaScript will look up the name in the following order:
183183
184184 1 . In case there is a ` var foo ` statement in the current scope, use that.
185185 2 . If one of the function parameters is named ` foo ` , use that.
@@ -191,9 +191,9 @@ function, JavaScript will lookup the name in the following order:
191191
192192### Namespaces
193193
194- A common problem of having only one global namespace is the likeliness of running
195- into problems where variable names clash. In JavaScript, this problem can
196- easily be avoided with the help of * anonymous wrappers* .
194+ A common problem associated with having only one global namespace is the
195+ likelihood of running into problems where variable names clash. In JavaScript,
196+ this problem can easily be avoided with the help of * anonymous wrappers* .
197197
198198 (function() {
199199 // a self contained "namespace"
@@ -208,13 +208,13 @@ easily be avoided with the help of *anonymous wrappers*.
208208Unnamed functions are considered [ expressions] ( #function.general ) ; so in order to
209209being callable, they must first be evaluated.
210210
211- ( // evaluate the function inside the paranthesis
211+ ( // evaluate the function inside the parentheses
212212 function() {}
213213 ) // and return the function object
214214 () // call the result of the evaluation
215215
216- There are other ways for evaluating and directly calling the function expression; which,
217- while different in syntax, do behave the exact same way.
216+ There are other ways to evaluate and directly call the function expression
217+ which, while different in syntax, behave the same way.
218218
219219 // A few other styles for directly invoking the
220220 !function(){}()
@@ -224,7 +224,7 @@ while different in syntax, do behave the exact same way.
224224
225225### In Conclusion
226226
227- It is recommended to always use an * anonymous wrapper* for encapsulating code in
227+ It is recommended to always use an * anonymous wrapper* to encapsulate code in
228228its own namespace. This does not only protect code against name clashes, but it
229229also allows for better modularization of programs.
230230
0 commit comments