diff --git a/06_object.txt b/06_object.txt index ba5732177..379b1a45d 100644 --- a/06_object.txt +++ b/06_object.txt @@ -84,7 +84,7 @@ object it was called on. For example, if there are different rabbits, the `speak` method must indicate which rabbit is speaking. When a function is called as a method—looked up as a property and -immediately called, as in `object.method()`—the special variable +immediately called, as in ++object.method()++—the special variable `this` in its body will point to the object that it was called on. // test: join diff --git a/09_regexp.txt b/09_regexp.txt index 11e719d24..a886201d7 100644 --- a/09_regexp.txt +++ b/09_regexp.txt @@ -822,7 +822,7 @@ console.log("Banana".match(/an/g)); So be cautious with global regular expressions. The cases where they are necessary—calls to `replace` and places where you want to -explicitly use `lastIndex`—are typically the only places where you +explicitly use ++lastIndex++—are typically the only places where you want to use them. A common pattern is to scan through all occurrences of a pattern in a diff --git a/11_language.txt b/11_language.txt index a3e056dc0..d40c7b1fb 100644 --- a/11_language.txt +++ b/11_language.txt @@ -310,7 +310,7 @@ will evaluate the second. Otherwise, the third gets evaluated. Because result of the second or third argument. Our language differs from JavaScript in its handling of the condition -value to `if`—it will not treat 0 or the empty string as false. +value to ++if++—it will not treat 0 or the empty string as false. The `while` form is similar; diff --git a/14_event.txt b/14_event.txt index ce53de976..c1de76868 100644 --- a/14_event.txt +++ b/14_event.txt @@ -713,7 +713,7 @@ if (Math.random() < .5) { // 50% chance ---- The `cancelAnimationFrame` function works in the same way as -`clearTimeout`—calling it on a value returned by +++clearTimeout++—calling it on a value returned by `requestAnimationFrame` will cancel that frame (assuming it hasn't already been called). diff --git a/15_game.txt b/15_game.txt index 864b14ac8..daf64b240 100644 --- a/15_game.txt +++ b/15_game.txt @@ -1223,7 +1223,7 @@ well: The `runAnimation` function, though nice and obvious, does not provide a clean way to pause the animation. The event handler that notices the key is best set up in -`runLevel`—setting it up in `runAnimation` would be cheating. That is +++runLevel++—setting it up in `runAnimation` would be cheating. That is supposed to be an general helper function for all kinds of animations, so it shouldn't handle a feature specific to this game. diff --git a/16_canvas.txt b/16_canvas.txt index c8ba5622a..52872bb39 100644 --- a/16_canvas.txt +++ b/16_canvas.txt @@ -284,7 +284,7 @@ computed. Easier to reason about are arcs—fragments of a circle. The `arcTo` method method takes five arguments. The first four act somewhat like -the arguments to `quadraticCurve`—the first two are a sort of control +the arguments to ++quadraticCurveTo++—the first two are a sort of control point, and the second two are the line's destination. The fifth argument provides the radius of the arc. The method will conceptually take a corner, a line going to the control point and then the diff --git a/17_http.txt b/17_http.txt index 6746160c5..7e51d432d 100644 --- a/17_http.txt +++ b/17_http.txt @@ -599,7 +599,7 @@ together that they make a significant difference. Calling `then` produces a new promise, whose result (the value passed to success handlers) depends on the return value of the first function we passed to `then`. If this function returns another promise, that -promise is “connected” to the one returned by `then`—its success or +promise is “connected” to the one returned by ++then++—its success or failure is passed on to the `then` promise. If the handler returns a normal, non-promise value, the output promise immediately succeeds, with that value as its result. diff --git a/Makefile b/Makefile index fedca7bb0..7d2cc1b7c 100644 --- a/Makefile +++ b/Makefile @@ -20,5 +20,5 @@ tex/%.tex: tex/%.db test: @for F in $(CHAPTERS); do echo Testing $$F:; node bin/run_tests.js $$F.txt; done - @! grep '[a-zA-Z]_[—“”‘’]\|[—“”‘’]_[a-zA-Z]' *.txt + @! grep '[a-zA-Z]_[—“”‘’]\|[—“”‘’]_[a-zA-Z]\|[a-zA-Z]`—' *.txt @echo Done.