Skip to content

Commit 92fc601

Browse files
committed
Integrate proofreading for chapter 4
1 parent 6f392dd commit 92fc601

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

04_data.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ never useful to start a statement with a curly-brace object, and in
288288
typical programs, there is no ambiguity between these two uses.
289289

290290
(((undefined)))Reading a property that doesn't exist will produce the
291-
value `undefined`, as happens the first time we try to read the `wolf`
291+
value `undefined`, which happens the first time we try to read the `wolf`
292292
property in the previous example.
293293

294294
(((property,assignment)))(((mutability)))(((= operator)))It is
@@ -306,7 +306,7 @@ inscribed on it.
306306
image::img/octopus-object.jpg[alt="Artist's representation of an object"]
307307

308308
(((delete operator)))(((property,deletion)))The `delete` operator cuts
309-
off a leg from such an octopus. It is a unary operator that, when
309+
off a tentacle from such an octopus. It is a unary operator that, when
310310
applied to a property access expression, will remove the named
311311
property from the object. This is not a common thing to do, but it is
312312
possible.
@@ -660,7 +660,7 @@ the time being, we won't worry about those.
660660
(((for/in loop)))(((for loop)))(((object,looping over)))What if
661661
we want to find all the events for which we have stored a coefficient?
662662
The properties don't form a predictable series, like they would in an
663-
array, so we can not use a normal `for` loop. JavaScript provides a
663+
array, so we cannot use a normal `for` loop. JavaScript provides a
664664
loop construct specifically for going over the properties of an
665665
object. It looks a little like a normal `for` loop but distinguishes
666666
itself by the use of the word `in`.
@@ -856,7 +856,7 @@ a `slice` method, which has a similar effect.
856856
to glue arrays together, similar to what the `+` operator does for
857857
strings. The following example shows both `concat` and `slice` in
858858
action. It takes an array and an index, and it returns a new array
859-
which is a copy of the original array with the element at the given
859+
that is a copy of the original array with the element at the given
860860
index removed.
861861

862862
[source,javascript]
@@ -1045,7 +1045,7 @@ function)))(((Math.atan function)))(((Math.PI
10451045
constant)))(((cosine)))(((sine)))(((tangent)))(((PI constant)))(((pi)))Back to
10461046
the `Math` object. If you need to do ((trigonometry)), `Math` can
10471047
help. It contains `cos` (cosine), `sin` (sine), and `tan` (tangent),
1048-
as well as their inverse functions, `acos`, `asin`, and `atan`. The
1048+
as well as their inverse functions, `acos`, `asin`, and `atan`, respectively. The
10491049
number π (pi)—or at least the closest approximation that fits in a
10501050
JavaScript number—is available as `Math.PI`. (There is an old
10511051
programming tradition of writing the names of ((constant)) values in
@@ -1070,7 +1070,7 @@ link:13_dom.html#sin_cos[Chapter 13], I'll explain them.
10701070

10711071
(((Math.random function)))(((random number)))The previous example
10721072
uses `Math.random`. This is a function that returns a new
1073-
pseudo-random number between zero (inclusive) and one (exclusive)
1073+
pseudorandom number between zero (inclusive) and one (exclusive)
10741074
every time you call it.
10751075

10761076
// test: no
@@ -1085,15 +1085,15 @@ console.log(Math.random());
10851085
// → 0.40180766698904335
10861086
----
10871087

1088-
(((pseudo-random number)))(((random number)))Though computers are
1088+
(((pseudorandom number)))(((random number)))Though computers are
10891089
deterministic machines—they always react the same way if given the
1090-
same input— it is possible to have them produce numbers that appear
1090+
same input—it is possible to have them produce numbers that appear
10911091
random. To do this, the machine keeps a number (or a bunch of numbers)
10921092
in its internal state. Then, every time a random number is requested,
10931093
it performs some complicated deterministic computations on this
10941094
internal state and returns part of the result of those computations.
10951095
The machine also uses the outcome to change its own internal state so
1096-
that the next "random" number produced will be different.
1096+
that the next random number produced will be different.
10971097

10981098
(((rounding)))(((Math.floor function)))If we want a whole random
10991099
number instead of a fractional one, we can use `Math.floor` (which
@@ -1108,13 +1108,13 @@ console.log(Math.floor(Math.random() * 10));
11081108
// → 2
11091109
----
11101110

1111-
Multiplying the random number by ten gives us a number greater than or
1112-
equal to zero, and below ten. Since `Math.floor` rounds down, this
1111+
Multiplying the random number by 10 gives us a number greater than or
1112+
equal to zero, and below 10. Since `Math.floor` rounds down, this
11131113
expression will produce, with equal chance, any number from 0 through
11141114
9.
11151115

11161116
(((Math.ceil function)))(((Math.round function)))There are also the
1117-
functions `Math.ceil` (for "ceiling", which rounds up to a whole
1117+
functions `Math.ceil` (for ceiling, which rounds up to a whole
11181118
number) and `Math.round` (to the nearest whole number).
11191119

11201120
== The global object ==
@@ -1165,7 +1165,7 @@ a given name. The same keyword can also be used in a `for` loop
11651165

11661166
=== The sum of a range ===
11671167

1168-
(((summing (exercise))))The introduction of this book alluded to the
1168+
(((summing (exercise))))The link:00_intro.html#intro[introduction] of this book alluded to the
11691169
following as a nice way to compute the sum of a range of numbers:
11701170

11711171
// test: no

0 commit comments

Comments
 (0)