@@ -538,7 +538,7 @@ <h1>JavaScript Garden</h1>
538
538
scope either via a < code > var</ code > statement or being the name of a formal parameter,
539
539
the < code > arguments</ code > object will not be created.</ p >
540
540
</ aside >
541
- < p > The < code > arguments</ code > variable is < strong > not</ strong > an < code > Array</ code > . While it has some of the
541
+ < p > The < code > arguments</ code > object is < strong > not</ strong > an < code > Array</ code > . While it has some of the
542
542
semantics of an array - namely the < code > length</ code > property - it does not inherit from
543
543
< code > Array.prototype</ code > and is in fact an < code > Object</ code > .</ p >
544
544
< p > Due to this, it is not possible to use standard array methods like < code > push</ code > ,
@@ -582,7 +582,7 @@ <h1>JavaScript Garden</h1>
582
582
< p > The < code > arguments</ code > object creates getter and setter functions for both its properties
583
583
as well as the function's formal parameters.</ p >
584
584
< p > As a result, changing the value of a formal parameter will also change the value
585
- corresponding formal parameter , and the other way around.</ p >
585
+ of the corresponding property of the arguments object , and the other way around.</ p >
586
586
< pre > < code > function foo(a, b, c) {
587
587
arguments[0] = 2;
588
588
a; // 2
@@ -597,11 +597,12 @@ <h1>JavaScript Garden</h1>
597
597
foo(1, 2, 3);
598
598
</ code > </ pre >
599
599
</ section > < section > < header > < h3 > Performance myths and truths</ h3 > </ header >
600
- < p > The < code > arguments</ code > is, except for the two cases named at the start of this section,
601
- always created. It doesn't matter whether it is used or not. Both getters and
602
- setters are < strong > always</ strong > created; thus, using it has nearly no performance impact
603
- at all, especially not in real world code where there is more than an access to
604
- the arguments object properties.</ p >
600
+ < p > The < code > arguments</ code > object is always created the only two exceptions being the cases
601
+ where it is declared as a name inside of a function or one of its formal
602
+ parameters. It does not matter whether it is used or not.</ p >
603
+ < p > Both getters and setters are < strong > always</ strong > created; thus, using it has nearly
604
+ no performance impact at all, especially not in real world code where there is
605
+ more than an access to the arguments object properties.</ p >
605
606
< aside >
606
607
< p > < strong > ES5 Note:</ strong > These getters and setters are not created in strict mode.</ p >
607
608
</ aside >
0 commit comments