Skip to content

Commit 747fa81

Browse files
committed
Fix some mistakes in Chapters 8 and 9
1 parent 77e046b commit 747fa81

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

08_error.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ it annoying, it will also necessarily be ineffective, since it takes
201201
too much time to exhaustively test everything every time you make a
202202
change.
203203

204-
Computers are good at repetetive tasks, and testing is the ideal
205-
repetetive task. Automated testing is the process of writing a program
204+
Computers are good at repetitive tasks, and testing is the ideal
205+
repetitive task. Automated testing is the process of writing a program
206206
that tests another program. Writing tests is a bit more work than
207207
testing manually, but once you've done it you gain a kind of
208208
superpower: it only takes you a few seconds to verify that your
@@ -832,7 +832,7 @@ Make sure you handle only the exceptions you are trying to handle.
832832
{{if interactive
833833

834834
```{test: no}
835-
class MultiplicatorUnitFailure extends Error () {}
835+
class MultiplicatorUnitFailure extends Error {}
836836
837837
function primitiveMultiply(a, b) {
838838
if (Math.random() < 0.2)

09_regexp.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,14 +1385,14 @@ let number = /^...$/;
13851385
// Tests:
13861386
for (let str of ["1", "-1", "+15", "1.55", ".5", "5.",
13871387
"1.3e2", "1E-4", "1e+12"]) {
1388-
if (!number.test(s)) {
1389-
console.log("Failed to match '" + s + "'");
1388+
if (!number.test(str)) {
1389+
console.log(`Failed to match '${s}'`);
13901390
}
13911391
}
13921392
for (let str of ["1a", "+-1", "1.2.3", "1+1", "1e4.5",
13931393
".5.", "1f5", "."]) {
1394-
if (number.test(s)) {
1395-
console.log("Incorrectly accepted '" + s + "'");
1394+
if (number.test(str)) {
1395+
console.log(`Incorrectly accepted '${s}'`);
13961396
}
13971397
}
13981398
```

code/solutions/08_2_the_locked_box.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
function withBoxUnlocked(body) {
22
var locked = box.locked;
3-
if (!locked)
3+
if (!locked) {
44
return body();
5+
}
56

67
box.unlock();
78
try {

0 commit comments

Comments
 (0)