|
4 | 4 |
|
5 | 5 | {{quote {author: "Charles Babbage", title: "Passages from the Life of a Philosopher (1864)", chapter: true} |
6 | 6 |
|
7 | | -On two occasions I have been asked, ‘Pray, Mr. Babbage, if you put |
8 | | -into the machine wrong figures, will the right answers come out?’ |
| 7 | +On two occasions I have been asked, 'Pray, Mr. Babbage, if you put |
| 8 | +into the machine wrong figures, will the right answers come out?' |
9 | 9 | [...] I am not able rightly to apprehend the kind of confusion of |
10 | 10 | ideas that could provoke such a question. |
11 | 11 |
|
@@ -156,15 +156,15 @@ difference is in how `x` is interpreted. When using a dot, the word |
156 | 156 | after the dot is the literal name of the property. When using square |
157 | 157 | brackets, the expression between the brackets is _evaluated_ to get |
158 | 158 | the property name. Whereas `value.x` fetches the property of `value` |
159 | | -named “x”, `value[x]` tries to evaluate the expression `x` and uses |
| 159 | +named "x", `value[x]` tries to evaluate the expression `x` and uses |
160 | 160 | the result as the property name. |
161 | 161 |
|
162 | 162 | So if you know that the property you are interested in is called |
163 | | -“length”, you say `value.length`. If you want to extract the property |
| 163 | +"length", you say `value.length`. If you want to extract the property |
164 | 164 | named by the value held in the binding `i`, you say `value[i]`. |
165 | 165 | Property names can be any string, and the dot notation only allows |
166 | 166 | names that look like valid binding names, so if you want to access a |
167 | | -property named “2” or “John Doe”, you must use square brackets: |
| 167 | +property named "2" or "John Doe", you must use square brackets: |
168 | 168 | `value[2]` or `value["John Doe"]`. |
169 | 169 |
|
170 | 170 | The elements in an ((array)) are stored as the array's properties, using |
@@ -209,8 +209,8 @@ value whose property we called. How this works is described in |
209 | 209 | [Chapter ?](object#obj_methods). |
210 | 210 |
|
211 | 211 | Properties that contain functions are generally called _methods_ of |
212 | | -the value they belong to. As in, “_toUpperCase_ is a method of a |
213 | | -string”. |
| 212 | +the value they belong to. As in, "_toUpperCase_ is a method of a |
| 213 | +string". |
214 | 214 |
|
215 | 215 | {{id array_methods}} |
216 | 216 |
|
@@ -374,7 +374,7 @@ arms in a neat row, labeled with numbers. |
374 | 374 |
|
375 | 375 | {{index journal, "weresquirrel example"}} |
376 | 376 |
|
377 | | -So we can represent Jacques’ journal as an array of objects. |
| 377 | +So we can represent Jacques' journal as an array of objects. |
378 | 378 |
|
379 | 379 | ```{test: wrap} |
380 | 380 | let journal = [ |
@@ -448,7 +448,7 @@ contains the same properties as `object1` but lives a separate life. |
448 | 448 | JavaScript's `==` operator, when comparing objects, will return `true` |
449 | 449 | only if both objects are precisely the same value. Comparing different |
450 | 450 | objects will return `false`, even if they have identical contents. |
451 | | -There is no “deep” comparison operation built into JavaScript, which |
| 451 | +There is no "deep" comparison operation built into JavaScript, which |
452 | 452 | looks at object's contents, but it is possible to write it yourself |
453 | 453 | (which will be one of the [exercises](data#exercise_deep_compare) at |
454 | 454 | the end of this chapter). |
@@ -1220,7 +1220,7 @@ like a good approach. |
1220 | 1220 |
|
1221 | 1221 | What we can do is _serialize_ the data. That means it is converted |
1222 | 1222 | into a flat description. A popular format is called _((JSON))_ |
1223 | | -(pronounced “Jason”), which stands for JavaScript Object Notation. It |
| 1223 | +(pronounced "Jason"), which stands for JavaScript Object Notation. It |
1224 | 1224 | is widely used as a data storage and communication format on the Web, |
1225 | 1225 | even in languages other than JavaScript. |
1226 | 1226 |
|
@@ -1305,7 +1305,7 @@ whether it does indeed return 55. |
1305 | 1305 | {{index "optional argument"}} |
1306 | 1306 |
|
1307 | 1307 | As a bonus assignment, modify your `range` function to take an |
1308 | | -optional third argument that indicates the “step” value used to build |
| 1308 | +optional third argument that indicates the "step" value used to build |
1309 | 1309 | up the array. If no step is given, the array elements go up by |
1310 | 1310 | increments of one, corresponding to the old behavior. The function |
1311 | 1311 | call `range(1, 10, 2)` should return `[1, 3, 5, 7, 9]`. Make sure it |
@@ -1518,7 +1518,7 @@ list and the loop is finished. |
1518 | 1518 | {{index recursion}} |
1519 | 1519 |
|
1520 | 1520 | The recursive version of `nth` will, similarly, look at an ever |
1521 | | -smaller part of the “tail” of the list and at the same time count down |
| 1521 | +smaller part of the "tail" of the list and at the same time count down |
1522 | 1522 | the index until it reaches zero, at which point it can return the |
1523 | 1523 | `value` property of the node it is looking at. To get the zeroeth |
1524 | 1524 | element of a list, you simply take the `value` property of its head |
|
0 commit comments