Skip to content

Commit 23dac36

Browse files
Clean up language in the types section.
1 parent 1246d87 commit 23dac36

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

doc/en/types/casting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ JavaScript is a *weakly typed* language, so it will apply *type coercion*
2121
> (Base 8). Octal support for these has been **removed** in ECMAScript 5 strict
2222
> mode.
2323
24-
In order to avoid the above, use of the [strict equal operator](#types.equality)
24+
To avoid the issues above, use of the [strict equal operator](#types.equality)
2525
is **highly** recommended. Although this avoids a lot of common pitfalls, there
2626
are still many further issues that arise from JavaScript's weak typing system.
2727

@@ -38,16 +38,16 @@ Using a built-in type like `Number` as a constructor will create a new `Number`
3838
object, but leaving out the `new` keyword will make the `Number` function behave
3939
like a converter.
4040

41-
In addition, having literals or non-object values in there will result in even
42-
more type coercion.
41+
In addition, passing literals or non-object values will result in even more
42+
type coercion.
4343

4444
The best option is to cast to one of the three possible types **explicitly**.
4545

4646
### Casting to a String
4747

4848
'' + 10 === '10'; // true
4949

50-
By prepending an empty string, a value can easily be casted to a string.
50+
By prepending an empty string, a value can easily be cast to a string.
5151

5252
### Casting to a Number
5353

doc/en/types/equality.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ to another number.
3131

3232
The strict equality operator consists of **three** equal signs: `===`.
3333

34-
It works exactly like the normal equality operator, except that strict equality
34+
It works like the normal equality operator, except that strict equality
3535
operator does **not** perform type coercion between its operands.
3636

3737
"" === "0" // false
@@ -50,8 +50,8 @@ the operands are of different types.
5050

5151
### Comparing Objects
5252

53-
While both `==` and `===` are stated as **equality** operators, they behave
54-
differently when at least one of their operands happens to be an `Object`.
53+
While both `==` and `===` are called **equality** operators, they behave
54+
differently when at least one of their operands is an `Object`.
5555

5656
{} === {}; // false
5757
new String('foo') === 'foo'; // false

doc/en/types/instanceof.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ nearly as useless as the [typeof operator](#types.typeof).
1313
new Bar() instanceof Bar; // true
1414
new Bar() instanceof Foo; // true
1515

16-
// This just sets Bar.prototype to the function object Foo
17-
// But not to an actual instance of Foo
16+
// This just sets Bar.prototype to the function object Foo,
17+
// but not to an actual instance of Foo
1818
Bar.prototype = Foo;
1919
new Bar() instanceof Foo; // false
2020

doc/en/types/typeof.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
The `typeof` operator (together with
44
[`instanceof`](#types.instanceof)) is probably the biggest
5-
design flaw of JavaScript, as it is near of being **completely broken**.
5+
design flaw of JavaScript, as it is almost **completely broken**.
66

7-
Although `instanceof` still has its limited uses, `typeof` really has only one
7+
Although `instanceof` still has limited uses, `typeof` really has only one
88
practical use case, which does **not** happen to be checking the type of an
99
object.
1010

11-
> **Note:** While `typeof` can also be called with a function like syntax
12-
> i.e. `typeof(obj)`, this is not a function call. The two parenthesis will
13-
> behave like normal and the return value will be used as the operand of the
14-
> `typeof` operator. There is **no** `typeof` function.
11+
> **Note:** While `typeof` can also be called with a function like syntax, i.e.
12+
> `typeof(obj)`, this is not a function call. The parentheses behave as normal
13+
> and the return value will be used as the operand of the `typeof` operator.
14+
> There is **no** `typeof` function.
1515
1616
### The JavaScript Type Table
1717

@@ -79,9 +79,8 @@ referencing it would result in a `ReferenceError`. This is the only thing
7979
In order to check the type of an object, it is highly recommended to use
8080
`Object.prototype.toString` because this is the only reliable way of doing so.
8181
As shown in the above type table, some return values of `typeof` are not defined
82-
in the specification; thus, they can differ across various implementations.
82+
in the specification; thus, they can differ between implementations.
8383

84-
Unless checking whether a variable is defined, `typeof` should be avoided at
85-
**all costs**.
84+
Unless checking whether a variable is defined, `typeof` should be avoided.
8685

8786

0 commit comments

Comments
 (0)