You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 00_intro.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ Each line of the previous program contains a single instruction. It could be wri
114
114
115
115
Although that is already more readable than the soup of bits, it is still rather obscure. Using names instead of numbers for the instructions and memory locations helps.
Copy file name to clipboardExpand all lines: 02_program_structure.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ Binding names can be any word. Digits can be part of binding names—`catch22` i
137
137
138
138
Words with a special meaning, such as `let`, are _((keyword))s_, and they may not be used as binding names. There are also a number of words that are "reserved for use" in ((future)) versions of JavaScript, which also can't be used as binding names. The full list of keywords and reserved words is rather long.
139
139
140
-
```{lang: "text/plain"}
140
+
```{lang: "null"}
141
141
break case catch class const continue debugger default
142
142
delete do else enum export extends false finally for
143
143
function if implements import interface in instanceof let
Copy file name to clipboardExpand all lines: 05_higher_order.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -219,7 +219,7 @@ Though I can fluently read only Latin characters, I appreciate the fact that peo
219
219
The example ((data set)) contains some pieces of information about the 140 scripts defined in Unicode. It is available in the [coding sandbox](https://eloquentjavascript.net/code#5) for this chapter[ ([_https://eloquentjavascript.net/code#5_](https://eloquentjavascript.net/code#5))]{if book} as the `SCRIPTS` binding. The binding contains an array of objects, each of which describes a script.
Copy file name to clipboardExpand all lines: 09_regexp.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -721,7 +721,7 @@ This makes use of the fact that the value of an ((assignment)) expression (`=`)
721
721
722
722
To conclude the chapter, we'll look at a problem that calls for ((regular expression))s. Imagine we are writing a program to automatically collect information about our enemies from the ((Internet)). (We will not actually write that program here, just the part that reads the ((configuration)) file. Sorry.) The configuration file looks like this:
Copy file name to clipboardExpand all lines: 13_browser.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ A _network ((protocol))_ describes a style of communication over a ((network)).
34
34
35
35
For example, the _Hypertext Transfer Protocol_ (((HTTP))) is a protocol for retrieving named ((resource))s (chunks of information, such as web pages or pictures). It specifies that the side making the request should start with a line like this, naming the resource and the version of the protocol that it is trying to use:
Copy file name to clipboardExpand all lines: 14_dom.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -513,7 +513,7 @@ When multiple rules define a value for the same property, the most recently read
513
513
514
514
It is possible to target things other than ((tag)) names in CSS rules. A rule for `.abc` applies to all elements with `"abc"` in their `class` attribute. A rule for `#xyz` applies to the element with an `id` attribute of `"xyz"` (which should be unique within the document).
Copy file name to clipboardExpand all lines: 16_game.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -403,7 +403,7 @@ As mentioned, the background is drawn as a `<table>` element. This nicely corres
403
403
404
404
The following ((CSS)) makes the table look like the background we want:
405
405
406
-
```{lang: "text/css"}
406
+
```{lang: "css"}
407
407
.background { background: rgb(52, 166, 251);
408
408
table-layout: fixed;
409
409
border-spacing: 0; }
@@ -441,7 +441,7 @@ function drawActors(actors) {
441
441
442
442
To give an element more than one class, we separate the class names by spaces. In the ((CSS)) code shown next, the `actor` class gives the actors their absolute position. Their type name is used as an extra class to give them a color. We don't have to define the `lava` class again because we're reusing the class for the lava grid squares we defined earlier.
By adding the level's current status as a class name to the wrapper, we can style the player actor slightly differently when the game is won or lost by adding a ((CSS)) rule that takes effect only when the player has an ((ancestor element)) with a given class.
467
467
468
-
```{lang: "text/css"}
468
+
```{lang: "css"}
469
469
.lost .player {
470
470
background: rgb(160, 64, 64);
471
471
}
@@ -484,7 +484,7 @@ After touching ((lava)), the player's color turns dark red, suggesting scorching
484
484
485
485
We can't assume that the level always fits in the _viewport_—the element into which we draw the game. That is why the `scrollPlayerIntoView` call is needed. It ensures that if the level is protruding outside the viewport, we scroll that viewport to make sure the player is near its center. The following ((CSS)) gives the game's wrapping DOM element a maximum size and ensures that anything that sticks out of the element's box is not visible. We also give it a relative position so that the actors inside it are positioned relative to the level's top-left corner.
Copy file name to clipboardExpand all lines: 20_node.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -186,7 +186,7 @@ In the `npm install` example, you could see a ((warning)) about the fact that th
186
186
187
187
The robot simulation from [Chapter ?](robot), as modularized in the exercise in [Chapter ?](modules#modular_robot), might have a `package.json` file like this:
Copy file name to clipboardExpand all lines: src/extract_hints.mjs
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
const{readdirSync, readFileSync}=require("fs")
1
+
import{readdirSync,readFileSync}from"fs"
2
2
3
3
process.stdout.write("# Exercise Hints\n\nThe hints below might help when you are stuck with one of the exercises in this book. They don't give away the entire solution, but rather try to help you find it yourself.\n\n");
0 commit comments