Skip to content

Commit 5b3eda5

Browse files
authored
Merge pull request getify#1808 from JEONGJIHUN/2nd-ed
fix typos
2 parents b6e0c9b + bc981ac commit 5b3eda5

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

get-started/apA.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ console.log(yourName);
3737

3838
See how `yourName` wasn't affected by the re-assignment of `myName` to `"Frank"`? That's because each variable holds its own copy of the value.
3939

40-
By contrast, references are the idea that two or more variables are pointing at the same value, such that modifying this shared value would be reflected by an access via any of those references. In JS, only object values (arrays, objects, functions, etc.) are treated as references.
40+
By contrast, references are the idea that two or more variables are pointing at the same value, such that modifying this shared value would be reflected by access via any of those references. In JS, only object values (arrays, objects, functions, etc.) are treated as references.
4141

4242
Consider:
4343

get-started/apB.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Once you have code that works, *compare* your solution(s) to the code in "Sugges
138138

139139
## Suggested Solutions
140140

141-
Keep in mind that these suggested solutions are just that: suggestions. There's many different ways to solve these practice exercises. Compare your approach to what you see here, and consider the pros and cons of each.
141+
Keep in mind that these suggested solutions are just that: suggestions. There are many different ways to solve these practice exercises. Compare your approach to what you see here, and consider the pros and cons of each.
142142

143143
Suggested solution for "Comparisons" (Pillar 3) practice:
144144

get-started/ch4.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ On the other hand, there's a *grain* you really should pay attention to and foll
8989

9090
Can you make your JS program look like a Java, C#, or Perl program? What about Python or Ruby, or even PHP? To varying degrees, sure you can. But should you?
9191

92-
No, I don't think you should. I think you should learn and embrace the JS way, and make your JS programs as JS'y as is practical. Some will think that means sloppy and informal programming, but I don't mean that at all. I just mean that JS has a lot of patterns and idioms that are recognizably "JS," and going with that *grain* is the general path to best success.
92+
No, I don't think you should. I think you should learn and embrace the JS way, and make your JS programs as JS'y as is practical. Some will think that means sloppy and informal programming, but I don't mean that at all. I just mean that JS has a lot of patterns and idioms that are recognizably "JS," and going with that *grain* is the general path to the best success.
9393

9494
Finally, maybe the most important *grain* to recognize is how the existing program(s) you're working on, and developers you're working with, do stuff. Don't read these books and then try to change *all that grain* in your existing projects over night. That approach will always fail.
9595

objects-classes/ch1.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is one of the most pervasive, but most incorrect, "facts" that perpetually
1111

1212
JS definitely has objects, but that doesn't mean that all values are objects. Nevertheless, objects are arguably the most important (and varied!) value type in the language, so mastering them is critical to your JS journey.
1313

14-
The object mechanism is certainly the most flexible and powerful container type -- something you put other values into; every JS program you write will use them in one way or another. But that's not why objects deserve top billing for this book. Objects are the the foundation for the second of JS's three pillars: the prototype.
14+
The object mechanism is certainly the most flexible and powerful container type -- something you put other values into; every JS program you write will use them in one way or another. But that's not why objects deserve top billing for this book. Objects are the foundation for the second of JS's three pillars: the prototype.
1515

1616
Why are prototypes (along with the `this` keyword, covered later in the book) so core to JS as to be one of its three pillars? Among other things, prototypes are how JS's object system can express the class design pattern, one of the most widely relied on design patterns in all of programming.
1717

@@ -145,7 +145,7 @@ The `42` property name will be treated as an integer property name (aka, index);
145145
| :--- |
146146
| If you need to actually use an object as a key/property name, never rely on this computed string coercion; its behavior is surprising and almost certainly not what's expected, so program bugs are likely to occur. Instead, use a more specialized data structure, called a `Map` (added in ES6), where objects used as property "names" are left as-is instead of being coerced to a string value. |
147147

148-
As with with `[myObj]` above, you can *compute* any **property name** (distinct from computing the property value) at the time of object literal definition:
148+
As with `[myObj]` above, you can *compute* any **property name** (distinct from computing the property value) at the time of object literal definition:
149149

150150
```js
151151
anotherObj = {
@@ -367,7 +367,7 @@ Object.entries(myObj);
367367
// [ ["favoriteNumber",42], ["isDeveloper",true], ["firstName","Kyle"] ]
368368
```
369369

370-
Added in ES6, `Object.entries(..)` retieves this list of entries -- containing only owned an enumerable properties; see the "Property Descriptors" section in the next chapter -- from a source object.
370+
Added in ES6, `Object.entries(..)` retrieves this list of entries -- containing only owned an enumerable properties; see the "Property Descriptors" section in the next chapter -- from a source object.
371371

372372
Such a list can be looped/iterated over, potentially assigning properties to another existing object. However, it's also possible to create a new object from a list of entries, using `Object.fromEntries(..)` (added in ES2019):
373373

objects-classes/ch3.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class Point3d extends Point2d {
394394
}
395395
}
396396

397-
var point new Point2d();
397+
var point = new Point2d();
398398

399399
point.getX(); // 3
400400

objects-classes/ch4.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ getGlobalThis() === globalThis; // true
12001200
| :--- |
12011201
| `eval("this")` would be sensitive to strict-mode, but `(1,eval)("this")` is not, and therefor reliably gives us the `globalThis` in any program. |
12021202

1203-
Unfortunately, the `new Function(..)` and `(1,eval)(..)` approaches both have an important limitation: that code will be blocked in browser-based JS code if the the app is served with certain Content-Security-Policy (CSP) restrictions, disallowing dynamic code evaluation (for security reasons).
1203+
Unfortunately, the `new Function(..)` and `(1,eval)(..)` approaches both have an important limitation: that code will be blocked in browser-based JS code if the app is served with certain Content-Security-Policy (CSP) restrictions, disallowing dynamic code evaluation (for security reasons).
12041204

12051205
Can we get around this? Yes, mostly. [^globalThisPolyfill]
12061206

scope-closures/apA.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ The latter one is definitely not an example of closure, at least not in any usef
933933

934934
### Defer to Closure
935935

936-
By the way, Chapter 7 briefly mentioned partial application and currying (which *do* rely on closure!). This is a interesting scenario where manual currying can be used:
936+
By the way, Chapter 7 briefly mentioned partial application and currying (which *do* rely on closure!). This is an interesting scenario where manual currying can be used:
937937

938938
```js
939939
function printLabels(labels) {
@@ -1013,7 +1013,7 @@ But I strongly prefer, and always use myself, the former `publicAPI` form. Two r
10131013

10141014
Whatever the case may be, it just seems rather silly to me that we *wouldn't* maintain a reference to access our own API. Right?
10151015

1016-
### Asynchronous Module Defintion (AMD)
1016+
### Asynchronous Module Definition (AMD)
10171017

10181018
Another variation on the classic module form is AMD-style modules (popular several years back), such as those supported by the RequireJS utility:
10191019

scope-closures/ch5.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ The term coined by TC39 to refer to this *period of time* from the entering of a
530530

531531
The TDZ is the time window where a variable exists but is still uninitialized, and therefore cannot be accessed in any way. Only the execution of the instructions left by *Compiler* at the point of the original declaration can do that initialization. After that moment, the TDZ is done, and the variable is free to be used for the rest of the scope.
532532

533-
A `var` also has technically has a TDZ, but it's zero in length and thus unobservable to our programs! Only `let` and `const` have an observable TDZ.
533+
A `var` also technically has a TDZ, but it's zero in length and thus unobservable to our programs! Only `let` and `const` have an observable TDZ.
534534

535535
By the way, "temporal" in TDZ does indeed refer to *time* not *position in code*. Consider:
536536

types-grammar/ch1.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ If `"` or `'` are used to delimit a string literal, the contents are only parsed
312312

313313
For single-character escape sequences, the following characters are recognized after a `\`: `b`, `f`, `n`, `r`, `t`, `v`, `0`, `'`, `"`, and `\`. For example, `\n` means new-line, `\t` means tab, etc.
314314
315-
If a `\` is followed by any other character (except `x` and `u` -- explained below), like for example `\k`, that sequence is interpted as the `\` being an unnecessary escape, which is thus dropped, leaving just the literal character itself (`k`).
315+
If a `\` is followed by any other character (except `x` and `u` -- explained below), like for example `\k`, that sequence is interpreted as the `\` being an unnecessary escape, which is thus dropped, leaving just the literal character itself (`k`).
316316
317317
To include a `"` in the middle of a `"`-delimited string literal, use the `\"` escape sequence. Similarly, if you're including a `'` character in the middle of a `'`-delimited string literal, use the `\'` escape sequence. By contrast, a `'` does *not* need to be escaped inside a `"`-delimited string, nor vice versa.
318318

@@ -365,7 +365,7 @@ Because the end-of-line `\` turns the new-line character into a line continuatio
365365
366366
Multi-character escape sequences may be hexadecimal or Unicode sequences.
367367
368-
Hexidecimal escape sequences are used to encode any of the base ASCII characters (codes 0-255), and look like `\x` followed by exactly two hexadecimal characters (`0-9` and `a-f` / `A-F` -- case insensitive). For example, `A9` or `a9` are decimal value `169`, which corresponds to:
368+
Hexadecimal escape sequences are used to encode any of the base ASCII characters (codes 0-255), and look like `\x` followed by exactly two hexadecimal characters (`0-9` and `a-f` / `A-F` -- case insensitive). For example, `A9` or `a9` are decimal value `169`, which corresponds to:
369369
370370
```js
371371
copyright = "\xA9"; // or "\xa9"
@@ -490,7 +490,7 @@ familyEmoji; // 👩‍👩‍👦‍👦
490490
491491
This emoji is *not* a single registered Unicode code-point, and as such, there's no *normalization* that can be performed to compose these 7 separate code-points into a single entity. The visual rendering logic for such composite symbols is quite complex, well beyond what most of JS developers want to embed into our programs. Libraries do exist for handling some of this logic, but they're often large and still don't necessarily cover all of the nuances/variations.
492492
493-
Unlike surrogate pairs and combining marks, the symbols in grapheme clusters can in fact act as standalone characters, but have the special combining behavior when placed adjactent to each other.
493+
Unlike surrogate pairs and combining marks, the symbols in grapheme clusters can in fact act as standalone characters, but have the special combining behavior when placed adjacent to each other.
494494
495495
This kind of complexity significantly affects length computations, comparison, sorting, and many other common string-oriented operations.
496496

types-grammar/ch3.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Now that we're comfortable with the built-in primitive types, we turn our attention to the `object` types in JS.
99

10-
I could write a whole book talking about objects in-depth; in fact, I already did! The "Objects & Classes" title of this series covers objects in-depth already, so make sure you've read that before continuning with this chapter.
10+
I could write a whole book talking about objects in-depth; in fact, I already did! The "Objects & Classes" title of this series covers objects in-depth already, so make sure you've read that before continuing with this chapter.
1111

1212
Rather than repeat that book's content, here we'll focus our attention on how the `object` value-type behaves and interacts with other values in JS.
1313

types-grammar/ch4.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ We need to expect and plan for that rather than allowing it to surprise us with
800800

801801
### To Primitive
802802

803-
Most operators in JS, including those we've see with coercions to `string` and `number`, are designed to run against primitive values. When any of these operators is used instead against an object value, the abstract `ToPrimitive` algorithm (as described earlier) is activated to coerce the object to a primitive.
803+
Most operators in JS, including those we've seen with coercions to `string` and `number`, are designed to run against primitive values. When any of these operators is used instead against an object value, the abstract `ToPrimitive` algorithm (as described earlier) is activated to coerce the object to a primitive.
804804

805805
Let's set up an object we can use to inspect how different operations behave:
806806

@@ -1490,7 +1490,7 @@ By contrast, JS is **dynamically-typed** (meaning types are discovered and manag
14901490
14911491
Does a dynamically-typed system automatically mean you're programming with less type-awareness? Many would argue that, but I disagree.
14921492

1493-
I do not at all think that declaring static types (annotations, as in TypeScript) is the only way to accomplish effective type-awareness. Clearly, though, proponents of static-typing believe that's is the *best* way.
1493+
I do not at all think that declaring static types (annotations, as in TypeScript) is the only way to accomplish effective type-awareness. Clearly, though, proponents of static-typing believe that is the *best* way.
14941494

14951495
Let me illustrate type-awareness without TypeScript's static typing. Consider this variable declaration:
14961496

0 commit comments

Comments
 (0)