Skip to content

Commit d0a740c

Browse files
de0umarijnh
authored andcommitted
Correct inverted uses of "only"
1 parent a92e698 commit d0a740c

19 files changed

Lines changed: 51 additions & 51 deletions

00_intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ underway on an ambitious version 4, which planned a number of radical
357357
improvements and extensions to the language. Changing a living, widely
358358
used language in such a radical way turned out to be politically
359359
difficult, and work on the version 4 was abandoned in 2008, leading to
360-
a much less ambitious version 5, which only made some uncontroversial
360+
a much less ambitious version 5, which made only some uncontroversial
361361
improvements, coming out in 2009. Then in 2015 version 6 came out, a
362362
major update that included some of the ideas planned for version 4.
363363
Since then we've had new, small updates every year.

01_values.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ match.
256256
Almost anything can be put between quotes, and JavaScript will make a
257257
string value out of it. But a few characters are more difficult. You
258258
can imagine how putting quotes between quotes might be hard.
259-
_Newlines_ (the characters you get when you press Enter) may only be
260-
included without escaping when the string is quoted with backticks
259+
_Newlines_ (the characters you get when you press Enter) may be
260+
included without escaping only when the string is quoted with backticks
261261
(`` ` ``).
262262

263263
{{index [escaping, "in strings"], "backslash character"}}

02_program_structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ console.log(mood);
135135

136136
You should imagine bindings as tentacles, rather than boxes. They do
137137
not _contain_ values; they _grasp_ them—two bindings can refer to the
138-
same value. A program can only access the values that it still has a
138+
same value. A program can access only the values that it still has a
139139
reference to. When you need to remember something, you grow a tentacle
140140
to hold on to it or you reattach one of your existing tentacles to it.
141141

@@ -411,7 +411,7 @@ doesn't represent a valid number. Thus, the condition translates to
411411
The statement below the `if` is wrapped in ((curly braces)) (`{` and
412412
`}`) in this example. Those can be used to group any number of
413413
statements into a single statement, called a _((block))_. You could
414-
also have omitted them in this case, since they only hold a single
414+
also have omitted them in this case, since they hold only a single
415415
statement, but to avoid having to think about whether they are needed
416416
or not, most JavaScript programmers use them in every wrapped
417417
statement like this. We'll mostly follow that convention in this book,

03_functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ such bindings wherever you want. These are called _global_.
117117
{{index "local scope", [binding, local]}}
118118

119119
But bindings created for function ((parameter))s or declared inside a
120-
function can only be referenced in that function, so they are known as
120+
function can be referenced only in that function, so they are known as
121121
_local_ bindings. Every time the function is called, new instances of these
122122
bindings are created. This provides some isolation between
123123
functions—each function call acts in its own little world (its local
@@ -151,7 +151,7 @@ console.log(x + z);
151151

152152
Each ((scope)) can "look out" into the scope around it, so `x` is
153153
visible inside the block in the example. The exception is when
154-
multiple bindings have the same name—in that case, code can only see
154+
multiple bindings have the same name—in that case, code can see only
155155
the innermost one. For example, when the code inside the `halve`
156156
function refers to `n`, it is seeing its _own_ `n`, not the global
157157
`n`.

04_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ the result, converted to a string, as the property name.
166166
So if you know that the property you are interested in is called
167167
_color_, you say `value.color`. If you want to extract the property
168168
named by the value held in the binding `i`, you say `value[i]`.
169-
Property names are strings. They can be any string, but the dot notation only works with
169+
Property names are strings. They can be any string, but the dot notation works only with
170170
names that look like valid binding names. So if you want to access a
171171
property named _2_ or _John Doe_, you must use square brackets:
172172
`value[2]` or `value["John Doe"]`.

05_higher_order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ characters are associated with a specific script. The standard
285285
contains 140 different scripts—81 are still in use today, and 59
286286
are historic.
287287

288-
Though I can only fluently read Latin characters, I appreciate the
288+
Though I can fluently read only Latin characters, I appreciate the
289289
fact that people are writing texts in at least 80 other writing
290290
systems, many of which I wouldn't even recognize. For example, here's
291291
a sample of ((Tamil)) handwriting.

06_object.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ constructor definition from the previous section. It just looks nicer.
379379

380380
{{index ["class declaration", properties]}}
381381

382-
Class declarations currently only allow _methods_—properties that hold
382+
Class declarations currently allow only _methods_—properties that hold
383383
functions—to be added to the ((prototype)). This can be somewhat
384384
inconvenient when you want to save a non-function value in there.
385385
The next version of the language will probably improve this. For now, you
@@ -549,7 +549,7 @@ simple interface to use their work.
549549
{{index "hasOwnProperty method", "in operator"}}
550550

551551
If you do have a plain object that you need to treat as a map for some
552-
reason, it is useful to know that `Object.keys` only returns an
552+
reason, it is useful to know that `Object.keys` returns only an
553553
object's _own_ keys, not those in the prototype. As an alternative to
554554
the `in` operator, you can use the `hasOwnProperty` method, which
555555
ignores the object's prototype.
@@ -865,7 +865,7 @@ console.log(temp.celsius);
865865

866866
The `Temperature` class allows you to read and write the temperature
867867
in either degrees ((Celsius)) or degrees ((Fahrenheit)), but
868-
internally only stores Celsius, and automatically converts to Celsius
868+
internally stores only Celsius, and automatically converts to Celsius
869869
in the `fahrenheit` getter and setter.
870870

871871
{{index "static method"}}

07_robot.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ way we could for 2 + 2. Instead, we have to keep creating potential
428428
solutions until we find one that works.
429429

430430
The number of possible routes through a graph is infinite. But
431-
when searching for a route from _A_ to _B_, we are only interested in
431+
when searching for a route from _A_ to _B_, we are interested only in
432432
the ones that start at _A_. We also don't care about routes that visit
433433
the same place twice—those are definitely not the most efficient route
434434
anywhere. So that cuts down on the amount of routes that the route
@@ -438,7 +438,7 @@ In fact, we are mostly interested in the _shortest_ route. So we want
438438
to make sure we look at short routes before we look at longer ones. A
439439
good approach would be to "grow" routes from the starting point,
440440
exploring every reachable place that hasn't been visited yet, until a
441-
route reaches the goal. That way, we'll only explore routes that are
441+
route reaches the goal. That way, we'll explore only routes that are
442442
potentially interesting, and find the shortest route (or one of the
443443
shortest routes, if there are more than one) to the goal.
444444

@@ -605,7 +605,7 @@ if}}
605605

606606
{{index "robot efficiency (exercise)"}}
607607

608-
The main limitation of `goalOrientedRobot` is that it only considers
608+
The main limitation of `goalOrientedRobot` is that it considers only
609609
one parcel at a time. It will often walk back and forth across the
610610
village because the parcel it happens to be looking at happens to be
611611
at the other side of the map, even if there are others much closer.
@@ -646,7 +646,7 @@ value.
646646

647647
{{index singleton}}
648648

649-
Why do you only need one `PGroup.empty` value, rather than having a
649+
Why do you need only one `PGroup.empty` value, rather than having a
650650
function that creates a new, empty map every time?
651651

652652
{{if interactive
@@ -693,7 +693,7 @@ To add a property (`empty`) to a constructor that is not a method, you
693693
have to add it to the constructor after the class definition, as a
694694
regular property.
695695

696-
You only need one `empty` instance because all empty groups are the
696+
You need only one `empty` instance because all empty groups are the
697697
same and instances of the class don't change. You can create many
698698
different groups from that single empty group without affecting it.
699699

08_error.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Computers are good at repetitive tasks, and testing is the ideal
208208
repetitive task. Automated testing is the process of writing a program
209209
that tests another program. Writing tests is a bit more work than
210210
testing manually, but once you've done it you gain a kind of
211-
superpower: it only takes you a few seconds to verify that your
211+
superpower: it takes you only a few seconds to verify that your
212212
program still behaves properly in all the situations you wrote tests
213213
for. When you break something, you'll immediately notice, rather than
214214
randomly running into it at some later time.
@@ -362,7 +362,7 @@ have the network fail.
362362

363363
{{index "error recovery"}}
364364

365-
If you're only programming for yourself, you can afford to just ignore
365+
If you're programming only for yourself, you can afford to just ignore
366366
such problems until they occur. But if you build something that is
367367
going to be used by anybody else, you usually want the program to do
368368
better than just crash. Sometimes the right thing to do is take the

09_regexp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ console.log(getDate("30-1-2003"));
444444

445445
{{index destructuring, "underscore character"}}
446446

447-
The `_` (underscore) binding is ignored, and only used to skip the
447+
The `_` (underscore) binding is ignored, and used only to skip the
448448
full match element in the array returned by `exec`.
449449

450450
## Word and string boundaries
@@ -918,7 +918,7 @@ found, `lastIndex` is set back to zero, which is also the value it has
918918
in a newly constructed regular expression object.
919919

920920
The difference between the global and the sticky options is that, when
921-
sticky is enabled, the match will only succeed if it starts directly
921+
sticky is enabled, the match will succeed only if it starts directly
922922
at `lastIndex`, whereas with global, it will search ahead for a
923923
position where a match can start.
924924

@@ -1352,7 +1352,7 @@ if}}
13521352

13531353
{{index "quoting style (exercise)", boundary}}
13541354

1355-
The most obvious solution is to only replace quotes with a nonword
1355+
The most obvious solution is to replace only quotes with a nonword
13561356
character on at least one side. Something like `/\W'|'\W/`. But you
13571357
also have to take the start and end of the line into account.
13581358

0 commit comments

Comments
 (0)