Skip to content

Commit d9aeb54

Browse files
Clean up language in the core section.
1 parent 23dac36 commit d9aeb54

File tree

4 files changed

+38
-40
lines changed

4 files changed

+38
-40
lines changed

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

0 commit comments

Comments
 (0)