Skip to content

Commit 2a31216

Browse files
committed
Merge in typo fixes by michaeltwofish
2 parents 71504f0 + 3dc251c commit 2a31216

20 files changed

+179
-177
lines changed

doc/en/array/constructor.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ the actual indexes of the array will not be initialized.
2121
arr[1]; // undefined
2222
1 in arr; // false, the index was not set
2323

24-
The behavior of being able to set the length of the array upfront only comes in
25-
handy in a few cases, like repeating a string, in which it avoids the use of a
26-
`for loop` code.
24+
Being able to set the length of the array in advance is only useful in a few
25+
cases, like repeating a string, in which it avoids the use of a `for loop`
26+
code.
2727

2828
new Array(count + 1).join(stringToRepeat);
2929

3030
### In Conclusion
3131

32-
The use of the `Array` constructor should be avoided as much as possible.
33-
Literals are definitely preferred. They are shorter and have a clearer syntax;
34-
therefore, they also increase the readability of the code.
32+
The use of the `Array` constructor should be avoided. Literals are definitely
33+
preferred. They are shorter, have a clearer syntax, and increase code
34+
readability.
3535

doc/en/core/delete.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ stuff in JavaScript which have a `DontDelete` attribute set.
55

66
### Global code and Function code
77

8-
When a variable or a function is defined in a global
9-
or a [function scope](#function.scopes) it is a property of either
10-
Activation object or Global object. Such properties have a set of attributes,
11-
one of these is `DontDelete`. Variable and function declarations in global
12-
and function code always create properties with `DontDelete`, therefore
13-
cannot be deleted.
8+
When a variable or a function is defined in a global or a [function
9+
scope](#function.scopes) it is a property of either the Activation object or
10+
the Global object. Such properties have a set of attributes, one of which is
11+
`DontDelete`. Variable and function declarations in global and function code
12+
always create properties with `DontDelete`, and therefore cannot be deleted.
1413

1514
// global variable:
1615
var a = 1; // DontDelete is set
@@ -29,8 +28,7 @@ cannot be deleted.
2928

3029
### Explicit properties
3130

32-
There are things which can be deleted normally: these are explicitly set
33-
properties.
31+
Explicitly set properties can be deleted normally.
3432

3533
// explicitly set property:
3634
var obj = {x: 1};
@@ -40,8 +38,8 @@ properties.
4038
obj.x; // undefined
4139
obj.y; // undefined
4240

43-
In the example above `obj.x` and `obj.y` can be deleted because they have no
44-
`DontDelete` atribute. That's why an example below works too.
41+
In the example above, `obj.x` and `obj.y` can be deleted because they have no
42+
`DontDelete` atribute. That's why the example below works too.
4543

4644
// this works fine, except for IE:
4745
var GLOBAL_OBJECT = this;
@@ -58,7 +56,7 @@ IE (at least 6-8) has some bugs, so the code above doesn't work.
5856

5957
### Function arguments and built-ins
6058

61-
Functions' normal arguments, [`arguments` object](#function.arguments)
59+
Functions' normal arguments, [`arguments` objects](#function.arguments)
6260
and built-in properties also have `DontDelete` set.
6361

6462
// function arguments and properties:
@@ -78,10 +76,10 @@ and built-in properties also have `DontDelete` set.
7876

7977
### Host objects
8078

81-
Behaviour of `delete` operator can be unpredictable for hosted objects. Due to
82-
specification, host objects are allowed to implement any kind of behavior.
79+
The behaviour of `delete` operator can be unpredictable for hosted objects. Due
80+
to the specification, host objects are allowed to implement any kind of behavior.
8381

8482
### In conclusion
8583

86-
`delete` operator often has an unexpected behaviour and can be safely used
87-
only for dealing with explicitly set properties on normal objects.
84+
The `delete` operator often has unexpected behaviour and can only be safely
85+
used to delete explicitly set properties on normal objects.

doc/en/core/eval.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The `eval` function will execute a string of JavaScript code in the local scope.
1212
foo; // 1
1313

1414
However, `eval` only executes in the local scope when it is being called
15-
**directly** *and* when the name of the called function is actually `eval`.
15+
directly *and* when the name of the called function is actually `eval`.
1616

1717
var foo = 1;
1818
function test() {
@@ -24,8 +24,8 @@ However, `eval` only executes in the local scope when it is being called
2424
test(); // 2
2525
foo; // 3
2626

27-
The use of `eval` should be avoided at **all costs**. 99.9% of its "uses" can be
28-
achieved **without** it.
27+
The use of `eval` should be avoided. 99.9% of its "uses" can be achieved
28+
**without** it.
2929

3030
### `eval` in Disguise
3131

@@ -35,13 +35,13 @@ in the global scope since `eval` is not being called directly in that case.
3535

3636
### Security Issues
3737

38-
`eval` also is a security problem. Because it executes **any** code given to it,
39-
it should **never** be used with strings of unknown or untrusted origins.
38+
`eval` also is a security problem, because it executes **any** code given to it.
39+
It should **never** be used with strings of unknown or untrusted origins.
4040

4141
### In Conclusion
4242

43-
`eval` should never be used. Any code that makes use of it is to be questioned in
44-
its workings, performance and security. In case something requires `eval` in
45-
order to work, it should **not** be used in the first place.
46-
A *better design* should be used, that does not require the use of `eval`.
43+
`eval` should never be used. Any code that makes use of it should be questioned
44+
in its workings, performance and security. If something requires `eval` in
45+
order to work, it should **not** be used in the first place. A *better design*
46+
should be used, that does not require the use of `eval`.
4747

doc/en/core/semicolon.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Below is the result of the parser's "guessing" game.
8484
})(window); //<- inserted
8585

8686
> **Note:** The JavaScript parser does not "correctly" handle return statements
87-
> which are followed by a new line, while this is not neccessarily the fault of
87+
> that are followed by a new line. While this is not neccessarily the fault of
8888
> the automatic semicolon insertion, it can still be an unwanted side-effect.
8989
9090
The parser drastically changed the behavior of the code above. In certain cases,
@@ -106,9 +106,9 @@ the above will yield a `TypeError` stating that `undefined is not a function`.
106106

107107
### In Conclusion
108108

109-
It is highly recommended to **never** omit semicolons; it is also advocated to
110-
keep braces on the same line with their corresponding statements and to never omit
111-
them for one single-line `if` / `else` statements. Both of these measures will
112-
not only improve the consistency of the code, but they will also prevent the
113-
JavaScript parser from changing its behavior.
109+
It is highly recommended to **never** omit semicolons. It is also recommended
110+
that braces be kept on the same line as their corresponding statements and to
111+
never omit them for single-line `if` / `else` statements. These measures will
112+
not only improve the consistency of the code, but they will also prevent the
113+
JavaScript parser from changing code behavior.
114114

doc/en/core/undefined.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## `undefined` and `null`
22

3-
JavaScript has two distinct values for `nothing`, the more useful of these two
4-
being `undefined`.
3+
JavaScript has two distinct values for nothing, `null` and `undefined`, with
4+
the latter being more useful.
55

66
### The Value `undefined`
77

@@ -16,14 +16,14 @@ overwritten.
1616
> mode, but its name can still be shadowed by for example a function with the name
1717
> `undefined`.
1818
19-
Some examples for when the value `undefined` is returned:
19+
Here are some examples of when the value `undefined` is returned:
2020

2121
- Accessing the (unmodified) global variable `undefined`.
22-
- Accessing a declared *but not* yet initialized variable
22+
- Accessing a declared *but not* yet initialized variable.
2323
- Implicit returns of functions due to missing `return` statements.
24-
- `return` statements which do not explicitly return anything.
24+
- `return` statements that do not explicitly return anything.
2525
- Lookups of non-existent properties.
26-
- Function parameters which do not had any explicit value passed.
26+
- Function parameters that do not have any explicit value passed.
2727
- Anything that has been set to the value of `undefined`.
2828
- Any expression in the form of `void(expression)`
2929

@@ -36,14 +36,14 @@ Since the global variable `undefined` only holds a copy of the actual *value* of
3636
Still, in order to compare something against the value of `undefined`, it is
3737
necessary to retrieve the value of `undefined` first.
3838

39-
In order to protect code against a possible overwritten `undefined` variable, a
40-
common technique used is to add an additional parameter to an
41-
[anonymous wrapper](#function.scopes) that gets no argument passed to it.
39+
To protect code against a possible overwritten `undefined` variable, a common
40+
technique used is to add an additional parameter to an [anonymous
41+
wrapper](#function.scopes) that gets no argument passed to it.
4242

4343
var undefined = 123;
4444
(function(something, foo, undefined) {
4545
// undefined in the local scope does
46-
// now again refer to the value
46+
// now again refer to the value `undefined`
4747

4848
})('Hello World', 42);
4949

doc/en/function/arguments.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ of the corresponding property on the `arguments` object, and the other way aroun
7979

8080
### Performance Myths and Truths
8181

82-
The `arguments` object is always created with the only two exceptions being the
83-
cases where it is declared as a name inside of a function or one of its formal
84-
parameters. It does not matter whether it is used or not.
82+
The only time the `arguments` object is not created is where it is declared as
83+
a name inside of a function or one of its formal parameters. It does not matter
84+
whether it is used or not.
8585

8686
Both *getters* and *setters* are **always** created; thus, using it has nearly
8787
no performance impact at all, especially not in real world code where there is
@@ -108,8 +108,7 @@ needs to know about both itself and its caller. This not only defeats possible
108108
performance gains that would arise from inlining, but it also breaks encapsulation
109109
because the function may now be dependent on a specific calling context.
110110

111-
It is **highly recommended** to **never** make use of `arguments.callee` or any of
112-
its properties.
111+
Making use of `arguments.callee` or any of its properties is **highly discouraged**.
113112

114113
> **ES5 Note:** In strict mode, `arguments.callee` will throw a `TypeError` since
115114
> its use has been deprecated.

doc/en/function/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ were defined. Since the only scoping that JavaScript has is
2727
Here, `Counter` returns **two** closures: the function `increment` as well as
2828
the function `get`. Both of these functions keep a **reference** to the scope of
2929
`Counter` and, therefore, always keep access to the `count` variable that was
30-
defined in that very scope.
30+
defined in that scope.
3131

3232
### Why Private Variables Work
3333

@@ -47,7 +47,7 @@ override - the *global* variable `count`.
4747
### Closures Inside Loops
4848

4949
One often made mistake is to use closures inside of loops, as if they were
50-
copying the value of the loops index variable.
50+
copying the value of the loop's index variable.
5151

5252
for(var i = 0; i < 10; i++) {
5353
setTimeout(function() {

doc/en/function/constructors.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The above calls `Foo` as constructor and sets the `prototype` of the newly
2525
created object to `Foo.prototype`.
2626

2727
In case of an explicit `return` statement, the function returns the value
28-
specified that statement, **but only** if the return value is an `Object`.
28+
specified by that statement, but **only** if the return value is an `Object`.
2929

3030
function Bar() {
3131
return 2;
@@ -72,24 +72,24 @@ explicitly return a value.
7272
new Bar();
7373
Bar();
7474

75-
Both calls to `Bar` return the exact same thing, a newly create object which
76-
has a property called `method` on it, which is a
75+
Both calls to `Bar` return the same thing, a newly create object that
76+
has a property called `method`, which is a
7777
[Closure](#function.closures).
7878

79-
It is also to note that the call `new Bar()` does **not** affect the prototype
80-
of the returned object. While the prototype will be set on the newly created
81-
object, `Bar` never returns that new object.
79+
It should also be noted that the call `new Bar()` does **not** affect the
80+
prototype of the returned object. While the prototype will be set on the newly
81+
created object, `Bar` never returns that new object.
8282

8383
In the above example, there is no functional difference between using and
8484
not using the `new` keyword.
8585

8686

8787
### Creating New Objects via Factories
8888

89-
An often made recommendation is to **not** use `new` because forgetting its use
90-
may lead to bugs.
89+
It is often recommended to **not** use `new` because forgetting its use may
90+
lead to bugs.
9191

92-
In order to create new object, one should rather use a factory and construct a
92+
In order to create a new object, one should rather use a factory and construct a
9393
new object inside of that factory.
9494

9595
function Foo() {
@@ -113,16 +113,16 @@ downsides.
113113

114114
1. It uses more memory since the created objects do **not** share the methods
115115
on a prototype.
116-
2. In order to inherit the factory needs to copy all the methods from another
116+
2. In order to inherit, the factory needs to copy all the methods from another
117117
object or put that object on the prototype of the new object.
118118
3. Dropping the prototype chain just because of a left out `new` keyword
119-
somehow goes against the spirit of the language.
119+
is contrary to the spirit of the language.
120120

121121
### In Conclusion
122122

123-
While omitting the `new` keyword might lead to bugs, it is certainly **not** a
124-
reason to drop the use of prototypes altogether. In the end it comes down to
125-
which solution is better suited for the needs of the application, it is
126-
especially important to choose a specific style of object creation **and stick**
127-
with it.
123+
While omitting the `new` keyword might lead to bugs, it is certainly **not** a
124+
reason to drop the use of prototypes altogether. In the end it comes down to
125+
which solution is better suited for the needs of the application. It is
126+
especially important to choose a specific style of object creation and use it
127+
**consistently**.
128128

doc/en/function/general.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ an *anonymous function* as a callback to another, possibly an asynchronous funct
88

99
function foo() {}
1010

11-
The above function gets [hoisted](#function.scopes) before the execution of the
12-
program starts; thus, it is available *everywhere* in the scope it was *defined*
13-
in, even if called before the actual definition in the source.
11+
The above function gets [hoisted](#function.scopes) before the execution of the
12+
program starts; thus, it is available *everywhere* in the scope it was
13+
*defined*, even if called before the actual definition in the source.
1414

1515
foo(); // Works because foo was created before this code runs
1616
function foo() {}

0 commit comments

Comments
 (0)