Skip to content

Commit 0b2986e

Browse files
committed
Integrate edits for Chapter 9
1 parent 0e72735 commit 0b2986e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

02_program_structure.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ How does a program keep an internal ((state))? How does it remember
8989
things? We have seen how to produce new values from old values, but
9090
this does not change the old values, and the new value has to be
9191
immediately used or it will dissipate again. To catch and hold values,
92-
JavaScript provides a thing called a _binding_, or _variable_.
92+
JavaScript provides a thing called a _binding_, or _variable_:
9393

9494
```
9595
let caught = 5 * 5;
@@ -120,7 +120,7 @@ console.log(ten * ten);
120120
When a binding points at a value, that does not mean it is tied to
121121
that value forever. The `=` operator can be used at any time on
122122
existing bindings to disconnect them from their current value and have
123-
them point to a new one.
123+
them point to a new one:
124124

125125
```
126126
let mood = "light";
@@ -141,7 +141,7 @@ hold on to it or you reattach one of your existing tentacles to it.
141141

142142
Let's look at another example. To remember the number of dollars that
143143
Luigi still owes you, you create a binding. And then when he pays back
144-
$35, you give this binding a new value.
144+
$35, you give this binding a new value:
145145

146146
```
147147
let luigisDebt = 140;
@@ -208,7 +208,7 @@ Words with a special meaning, such as `const`, are _((keyword))s_, and
208208
they may not be used as binding names. There are also a number of
209209
words that are "reserved for use" in ((future)) versions of
210210
JavaScript, which also can't be used as binding names. The full list
211-
of keywords and reserved words is rather long.
211+
of keywords and reserved words is rather long:
212212

213213
```{lang: "text/plain"}
214214
break case catch class const continue debugger default
@@ -274,14 +274,14 @@ looks, but can be helpful in toy programs and experiments.
274274

275275
{{index "JavaScript console", "developer tools", "Node.js", "console.log", output}}
276276

277-
In examples, I used `console.log` to output values. Most JavaScript
277+
In the examples, I used `console.log` to output values. Most JavaScript
278278
systems (including all modern web ((browser))s and Node.js) provide a
279279
`console.log` function that writes out its arguments to _some_ text
280280
output device. In browsers, the output lands in the ((JavaScript
281281
console)). This part of the browser interface is hidden by default,
282-
but most browsers open it when you press F12 or, on Mac, when you
283-
press Command-Option-I. If that does not work, search through the
284-
menus for an item named "developer tools" or similar.
282+
but most browsers open it when you press F12 or, on Mac, Command-Option-I.
283+
If that does not work, search through the menus for an item named "developer
284+
tools" or similar.
285285

286286
{{if interactive
287287

@@ -615,15 +615,15 @@ amount.
615615

616616
Many loops follow the pattern seen in the `while` examples. First, a
617617
"counter" binding is created to track the progress of the loop. Then
618-
comes a `while` loop, whose test expression usually checks whether the
618+
comes a `while` loop, usually with a test expression that checks whether the
619619
counter has reached its end value. At the end of the loop body, the
620620
counter is updated to track progress.
621621

622622
{{index "for loop", loop}}
623623

624624
Because this pattern is so common, JavaScript and similar languages
625625
provide a slightly shorter and more comprehensive form, the `for`
626-
loop.
626+
loop:
627627

628628
```
629629
for (let number = 0; number <= 12; number = number + 2) {
@@ -938,7 +938,7 @@ following triangle:
938938
{{index [string, length]}}
939939

940940
It may be useful to know that you can find the length of a string by
941-
writing `.length` after it.
941+
writing `.length` after it:
942942

943943
```
944944
let abc = "abc";
@@ -1012,7 +1012,7 @@ number, so you'll have to create an `if`/`else if`/`else` chain.
10121012
The second version of the program has a straightforward solution and a
10131013
clever one. The simple way is to add another conditional "branch" to
10141014
precisely test the given condition. For the clever method, build up a
1015-
string containing the word or words to output, and print either this
1015+
string containing the word or words to output and print either this
10161016
word or the number if there is no word, potentially by making good use
10171017
of the `||` operator.
10181018

0 commit comments

Comments
 (0)