File tree Expand file tree Collapse file tree 7 files changed +10
-10
lines changed
Expand file tree Collapse file tree 7 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11## Array Iteration and Properties
22
33Although arrays in JavaScript are objects, there are no good reasons to use
4- the [ ` for in loop ` ] ( #object.forinloop ) in for iteration on them . In fact, there
4+ the [ ` for in ` ] ( #object.forinloop ) loop . In fact, there
55are a number of good reasons ** against** the use of ` for in ` on arrays.
66
77> ** Note:** JavaScript arrays are ** not** * associative arrays* . JavaScript only
Original file line number Diff line number Diff line change @@ -51,10 +51,10 @@ In the example above `obj.x` and `obj.y` can be deleted because they have no
5151 GLOBAL_OBJECT.a; // undefined
5252
5353Here we use a trick to delete ` a ` . [ ` this ` ] ( #function.this ) here refers
54- to the Global object and we explicitly declare variable ` a ` as it's property
54+ to the Global object and we explicitly declare variable ` a ` as its property
5555which allows us to delete it.
5656
57- IE (at least 6-8) has some bugs, so code above doesn't work.
57+ IE (at least 6-8) has some bugs, so the code above doesn't work.
5858
5959### Function arguments and built-ins
6060
Original file line number Diff line number Diff line change 22
33Functions in JavaScript are first class objects. That means they can be
44passed around like any other value. One common use of this feature is to pass
5- an * anonymous function* as a callback to another, possibly asynchronous function.
5+ an * anonymous function* as a callback to another, possibly an asynchronous function.
66
77### The ` function ` Declaration
88
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ has been applied.
153153Without the knowledge about * hoisting* , the below code might seem to raise a
154154` ReferenceError ` .
155155
156- // check whether SomeImportantThing has been initiliazed
156+ // check whether SomeImportantThing has been initialized
157157 if (!SomeImportantThing) {
158158 var SomeImportantThing = {};
159159 }
@@ -163,7 +163,7 @@ moved to the top of the *global scope*.
163163
164164 var SomeImportantThing;
165165
166- // other code might initiliaze SomeImportantThing here, or not
166+ // other code might initialize SomeImportantThing here, or not
167167
168168 // make sure it's there
169169 if (!SomeImportantThing) {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ literals act as objects too.
2828Objects in JavaScript can also be used as a [ * Hashmap* ] [ 1 ] ; they mainly consist
2929of named properties mapping to values.
3030
31- Using a object literal - ` {} ` notation - it is possible to create a
31+ Using an object literal - ` {} ` notation - it is possible to create a
3232plain object. This new object [ inherits] ( #object.prototype ) from ` Object.prototype ` and
3333has no [ own properties] ( #object.hasownproperty ) defined on it.
3434
@@ -42,7 +42,7 @@ has no [own properties](#object.hasownproperty) defined on it.
4242The properties of an object can be accessed in two ways, via either the dot
4343notation or the square bracket notation.
4444
45- var foo = {name: 'Kitten '}
45+ var foo = {name: 'kitten '}
4646 foo.name; // kitten
4747 foo[ 'name'] ; // kitten
4848
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ necessary to use an *external* `hasOwnProperty` in order to get correct results.
4444 // Use another Object's hasOwnProperty and call it with 'this' set to foo
4545 ({}).hasOwnProperty.call(foo, 'bar'); // true
4646
47- // It's also possible use the hasOwnProperty property from the Object property for this purpuse
47+ // It's also possible use the hasOwnProperty property from the Object property for this purpose
4848 Object.prototype.hasOwnProperty.call(obj, 'bar'); // true
4949
5050
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ function that will get called by either of the timeout functions.
138138 function foo(a, b, c) {}
139139
140140 // NEVER use this
141- setTimeout('foo(1,2, 3)', 1000)
141+ setTimeout('foo(1, 2, 3)', 1000)
142142
143143 // Instead use an anonymous function
144144 setTimeout(function() {
You can’t perform that action at this time.
0 commit comments