Skip to content

Commit 20eadb8

Browse files
committed
Add index terms to Chapter 5
1 parent 932bb07 commit 20eadb8

File tree

4 files changed

+421
-365
lines changed

4 files changed

+421
-365
lines changed

02_program_structure.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ link:04_data.html#properties[Chapter 4].
277277
== Return values ==
278278

279279
(((comparison,of numbers)))(((return value)))(((Math.max
280-
function)))(((max function)))Showing a dialog box or writing text to
280+
function)))(((maximum)))Showing a dialog box or writing text to
281281
the screen is a _((side effect))_. A lot of functions are useful
282282
because of the side effects they produce. Functions may also produce
283283
values, and in that case, they don't need to have a side effect to be
@@ -290,7 +290,7 @@ console.log(Math.max(2, 4));
290290
// → 4
291291
----
292292

293-
(((function,application)))(((min function)))(((Math.min
293+
(((function,application)))(((minimum)))(((Math.min
294294
function)))When a function produces a value, it is said to _return_
295295
that value. Anything that produces a value is an ((expression)) in
296296
JavaScript, which means function calls can be used within larger

03_functions.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -891,11 +891,12 @@ organize regular text.
891891

892892
=== Minimum ===
893893

894-
(((Math object)))(((minimum (exercise))))(((Math.min function)))(((min
895-
function)))The link:02_program_structure.html#return_values[previous
896-
chapter] introduced the standard function `Math.min` that returns its
897-
smallest argument. We can do that ourselves now. Write a function
898-
`min` that takes two arguments and returns their minimum.
894+
(((Math object)))(((minimum (exercise))))(((Math.min
895+
function)))(((minimum)))The
896+
link:02_program_structure.html#return_values[previous chapter]
897+
introduced the standard function `Math.min` that returns its smallest
898+
argument. We can do that ourselves now. Write a function `min` that
899+
takes two arguments and returns their minimum.
899900

900901
ifdef::html_target[]
901902

04_data.txt

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,9 @@ get fields like (!html n~1•~!)(!tex pass:[$n_{1\bullet}$]!) because
564564
the sums of rows or columns are not stored directly in our data
565565
structure.
566566

567-
Jacques kept his journal for three months. The resulting data set is
568-
available in the coding sandbox for this chapter(!tex
567+
(((JOURNAL data set)))Jacques kept his journal for three months. The
568+
resulting ((data set)) is available in the coding sandbox for this
569+
chapter(!tex
569570
(http://eloquentjavascript.net/code[_eloquentjavascript.net/code_])!),
570571
where it is stored in the `JOURNAL` variable, and in a downloadable
571572
http://eloquentjavascript.net/code/jacques_journal.js[file].
@@ -1016,10 +1017,10 @@ them into an array.
10161017
== The Math object ==
10171018

10181019
(((Math object)))(((Math.min function)))(((Math.max
1019-
function)))(((Math.sqrt function)))(((min function)))(((max
1020-
function)))(((sqrt function)))As we've seen, `Math` is a grab-bag of
1021-
number-related utility functions, such as `Math.max` (maximum),
1022-
`Math.min` (minimum), and `Math.sqrt` (square root).
1020+
function)))(((Math.sqrt function)))(((minimum)))(((maximum)))(((square
1021+
root)))As we've seen, `Math` is a grab-bag of number-related utility
1022+
functions, such as `Math.max` (maximum), `Math.min` (minimum), and
1023+
`Math.sqrt` (square root).
10231024

10241025
[[namespace_pollution]]
10251026
(((namespace)))(((namespace pollution)))(((Object type)))The
@@ -1043,12 +1044,11 @@ neither, so be careful.
10431044

10441045
(((trigonometry)))(((Math.cos function)))(((Math.sin
10451046
function)))(((Math.tan function)))(((Math.acos function)))(((Math.asin
1046-
function)))(((Math.atan function)))(((Math.PI constant)))(((cos
1047-
function)))(((sin function)))(((tan function)))(((acos
1048-
function)))(((asin function)))(((atan function)))(((PI constant)))Back
1049-
to the `Math` object. If you need to do trigonometry, `Math` can help.
1050-
It contains `cos` (cosine), `sin` (sine), and `tan` (tangent), as well
1051-
as their inverse functions, `acos`, `asin`, and `atan`. The number π
1047+
function)))(((Math.atan function)))(((Math.PI
1048+
constant)))(((cosine)))(((sine)))(((tangent)))(((PI constant)))Back to
1049+
the `Math` object. If you need to do trigonometry, `Math` can help. It
1050+
contains `cos` (cosine), `sin` (sine), and `tan` (tangent), as well as
1051+
their inverse functions, `acos`, `asin`, and `atan`. The number π
10521052
(pi)—or at least the closest approximation that fits in a JavaScript
10531053
number—is available as `Math.PI`. (There is an old programming
10541054
tradition of writing the names of constant values in all caps.)
@@ -1070,7 +1070,7 @@ If sines and cosines are not something you are very familiar with,
10701070
don't worry. When they are used in this book, in
10711071
link:13_dom.html#sin_cos[Chapter 13], I'll explain them.
10721072

1073-
(((Math.random function)))(((random function)))The previous example
1073+
(((Math.random function)))(((random numbers)))The previous example
10741074
uses `Math.random`. This is a function that returns a new
10751075
pseudo-random number between zero (inclusive) and one (exclusive)
10761076
every time you call it.
@@ -1097,10 +1097,10 @@ internal state and returns part of the result of those computations.
10971097
The machine also uses the outcome to change its own internal state so
10981098
that the next "random" number produced will be different.
10991099

1100-
(((rounding)))(((Math.floor function)))(((floor function)))If we want
1101-
a whole random number instead of a fractional one, we can use
1102-
`Math.floor` (which rounds down to the nearest whole number) on the
1103-
result of `Math.random`.
1100+
(((rounding)))(((Math.floor function)))If we want a whole random
1101+
number instead of a fractional one, we can use `Math.floor` (which
1102+
rounds down to the nearest whole number) on the result of
1103+
`Math.random`.
11041104

11051105
// test: no
11061106

@@ -1115,10 +1115,9 @@ equal to zero, and below ten. Since `Math.floor` rounds down, this
11151115
expression will produce, with equal chance, any number from 0 through
11161116
9.
11171117

1118-
(((Math.ceil function)))(((Math.round function)))(((ceil
1119-
function)))(((round function))))There are also the functions
1120-
`Math.ceil` (for "ceiling", which rounds up to a whole number) and
1121-
`Math.round` (to the nearest whole number).
1118+
(((Math.ceil function)))(((Math.round function)))There are also the
1119+
functions `Math.ceil` (for "ceiling", which rounds up to a whole
1120+
number) and `Math.round` (to the nearest whole number).
11221121

11231122
== The global object ==
11241123

0 commit comments

Comments
 (0)