Skip to content

Commit 931e1d9

Browse files
committed
Automatic merge from master.
1 parent 94a3304 commit 931e1d9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

index.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ <h1>JavaScript Garden</h1>
287287
<article><section><header><h2 id="functions">Functions <a href="#intro">#top</a></h2></header>
288288
<p>Functions in JavaScript are first class objects, which means that they can be
289289
passed around like any other value. One common use of this feature is to pass
290-
an <em>anonymous function</em> as a callback to another, possible asynchronous function.</p>
290+
an <em>anonymous function</em> as a callback to another, possibly asynchronous function.</p>
291291
</section><section><header><h3>The <code>function</code> declaration</h3></header>
292292
<pre><code>function foo() {}
293293
</code></pre>
@@ -563,15 +563,15 @@ <h1>JavaScript Garden</h1>
563563
}
564564
foo(1, 2, 3);
565565
</code></pre>
566-
<aside>
567-
<p><strong>ES5 Note:</strong> These getters and setters are not created in strict mode.</p>
568-
</aside>
569566
</section><section><header><h3>Performance myths and truths</h3></header>
570567
<p>The <code>arguments</code> is, except for the two cases named at the start of this section,
571568
always created. It doesn't matter whether it is used or not. Both getters and
572569
setters are <strong>always</strong> created; thus, using it has nearly no performance impact
573570
at all, especially not in real world code where there is more than an access to
574571
the arguments object properties.</p>
572+
<aside>
573+
<p><strong>ES5 Note:</strong> These getters and setters are not created in strict mode.</p>
574+
</aside>
575575
<p>However, there is one case which will drastically reduce the performance in
576576
modern JavaScript engines. That case is the use of <code>arguments.callee</code>.</p>
577577
<pre><code>function foo() {
@@ -962,11 +962,11 @@ <h1>JavaScript Garden</h1>
962962
</code></pre>
963963
<p>Since it is not possible to change the behavior of the <code>for in</code> loop itself, it
964964
is necessary to filter out the unwanted properties inside the loop body itself,
965-
this is done by using the <a href="#hasownproperty"><code>hasOwnProperty</code></a> method of the
966-
object. </p>
965+
this is done by using the <a href="#hasownproperty"><code>hasOwnProperty</code></a> method of
966+
objects. </p>
967967
<aside>
968968
<p><strong>Note:</strong> Since the <code>for in</code> always traverses the complete prototype chain, it
969-
will get slow with each additional layer of inheritance added to an object.</p>
969+
will get slower with each additional layer of inheritance added to an object.</p>
970970
</aside>
971971
</section><section><header><h3>Using <code>hasOwnProperty</code> for filtering</h3></header>
972972
<pre><code>// still the foo from above
@@ -978,8 +978,8 @@ <h1>JavaScript Garden</h1>
978978
</code></pre>
979979
<p>This version is the only correct one to use. Due to the use of <code>hasOwnPropery</code> it
980980
will <strong>only</strong> print out <code>moo</code>. When <code>hasOwnProperty</code> is left out, the code is
981-
prone to errors when the native prototypes have been extended; for example,
982-
<code>Object.prototype</code>.</p>
981+
prone to errors when the native prototypes (for example,
982+
<code>Object.prototype</code>) have been extended.</p>
983983
<p>One widely used framework which does this is <a href="http://www.prototypejs.org/">Prototype</a>. When this
984984
framework is included, <code>for in</code> loops that do not use <code>hasOwnProperty</code> are
985985
guaranteed to break.</p>
@@ -1104,7 +1104,7 @@ <h1>JavaScript Garden</h1>
11041104

11051105
// These are false
11061106
10 == 010;
1107-
10 == '-10'
1107+
10 == '-10';
11081108
</code></pre>
11091109
<aside>
11101110
<p><strong>Note:</strong> Number literals that start with a <code>0</code> are interpreted as octal (Base

0 commit comments

Comments
 (0)