Skip to content

Commit 1299547

Browse files
committed
Merge pull request basarat#6 from dwillmer/master
Minor typos
2 parents f7bb897 + 39b64e3 commit 1299547

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

docs/arrow-functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Lovingly called the *fat arrow* (becuase `->` is a thin arrow and `=>` is a fat arrow) and also called a *lambda function* (because of other languages). Another commonly used feature is the fat arrow function `()=>something`. The motivation for a *fat arrow* is:
44
1. You don't need to keep typing `function`
5-
1. I lexically captures the meaning of `this`
5+
2. It lexically captures the meaning of `this`
66

77
For a language that claims to be functional, in JavaScript you tend to be typing `function` quite a lot. The fat arrow makes it simple for you to create a function
88
```ts
@@ -76,4 +76,4 @@ person.growOld();
7676
```
7777
then `this` is going to be the correct calling context (in this example `person`).
7878

79-
{% include "footer.md" %}
79+
{% include "footer.md" %}

docs/classes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ console.log(Foo.prototype); // {} i.e. it exists and is not undefined
234234
console.log(Foo.prototype.constructor === Foo); // Has a member called `constructor` pointing back to the function
235235
```
236236

237-
Now lets look at *effect of `new` on `this` inside the called function*. Basically `this` inside the called function is going to point to the newly created object that will be returned from the function. Its simple to see if you mutate a property on `this` inside the function:
237+
Now lets look at *effect of `new` on `this` inside the called function*. Basically `this` inside the called function is going to point to the newly created object that will be returned from the function. It's simple to see if you mutate a property on `this` inside the function:
238238

239239
```ts
240240
function Foo() {
@@ -270,7 +270,7 @@ But wait we wanted `d.prototype.__proto__` i.e. just the proto changed and maint
270270

271271
#### `d.prototype.__proto__ = b.prototype` significance
272272

273-
The significance is that it allows you to add members functions to a child class and inherit other from the base class. This is demonstrated by the following simple example:
273+
The significance is that it allows you to add member functions to a child class and inherit others from the base class. This is demonstrated by the following simple example:
274274

275275
```ts
276276
function Animal() { }

docs/destructuring.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var rect = { x: 0, y: 10, width: 15, height: 20 };
1515
var {x, y, width, height} = rect;
1616
console.log(x, y, width, height); // 0,10,15,20
1717
```
18-
Here in the absence of destructing you would have to pick off `x,y,width,height` one by one from `rect`.
18+
Here in the absence of destructuring you would have to pick off `x,y,width,height` one by one from `rect`.
1919

2020
#### Array Destructuring
2121
A common programming question : Swap two variables without using a third one. The TypeScript solution:
@@ -59,7 +59,7 @@ var _a;
5959
```
6060

6161
#### Summary
62-
Destructuring can make your code more readable and maintainable by reducing the line count and making the intent clear. Array destructuring can allow to use arrays as though they were tuples.
62+
Destructuring can make your code more readable and maintainable by reducing the line count and making the intent clear. Array destructuring can allow you to use arrays as though they were tuples.
6363

6464

6565
{% include "footer.md" %}

docs/for...of.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ for (let paragraph of articleParagraphs) {
5858
Use `for...of` only for stuff that *you know* to be an array or a string. Note that this limitation might be removed in a future version of TypeScript.
5959

6060
#### Summary
61-
You would be surprised at how many times you will be iterating over the elements of an array. The next time you find yourself doing that, give `for...of` a go. You might just make the next person who reviews you code happy.
61+
You would be surprised at how many times you will be iterating over the elements of an array. The next time you find yourself doing that, give `for...of` a go. You might just make the next person who reviews your code happy.
6262

6363
{% include "footer.md" %}

docs/let.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ for (var j = 0; j < 3; j++) {
108108
funcs[j]();
109109
}
110110
```
111-
Here the functions close over (hence called a `closure`) the *local* variable (conviniently named `local`) and use that instead of the loop variable `i`. Note that closures come with a performance impact (they need to store the surrounding state) and therefore even though the ES6 `let` keyword in a loop would have the same behavior as the previous example, the following is an error in TypeScript if you target something less that ES6:
111+
Here the functions close over (hence called a `closure`) the *local* variable (conveniently named `local`) and use that instead of the loop variable `i`. Note that closures come with a performance impact (they need to store the surrounding state) and therefore even though the ES6 `let` keyword in a loop would have the same behavior as the previous example, the following is an error in TypeScript if you target something less than ES6:
112112

113113
```ts
114114
var funcs = [];
@@ -133,4 +133,4 @@ Despite a few limitations, we find `let` to be extremely useful to have for the
133133

134134
{% include "footer.md" %}
135135

136-
[](https://github.com/olov/defs/blob/master/loop-closures.md)
136+
[](https://github.com/olov/defs/blob/master/loop-closures.md)

docs/spread-operator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The main objective of the spread operator is to *spread* the objects of an array. This is best explained with examples.
44

55
#### Apply
6-
A common use case it to spread an array into the function arguments. Previously you would need to use `Function.prototype.apply`:
6+
A common use case is to spread an array into the function arguments. Previously you would need to use `Function.prototype.apply`:
77

88
```ts
99
function foo(x, y, z) { }
@@ -40,6 +40,6 @@ console.log(list); // [1,2,3,4]
4040
```
4141

4242
#### Summary
43-
`apply` is something that you would inevitably do in JavaScript, so its good to have a better syntax where you don't have that ugly `null` for the `this` argument. Also having a dedicated syntax for moving arrays out of (destructuring) or into (assignment) other arrays provides neat syntax for when you are doing array processing on partial arrays.
43+
`apply` is something that you would inevitably do in JavaScript, so it's good to have a better syntax where you don't have that ugly `null` for the `this` argument. Also having a dedicated syntax for moving arrays out of (destructuring) or into (assignment) other arrays provides neat syntax for when you are doing array processing on partial arrays.
4444

4545
{% include "footer.md" %}

docs/template-strings.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Never gonna let you down`;
2121
```
2222

2323
#### String Interpolation
24-
Another common use case is when you want to generate some string out of some static strings + some variables. For this you would need some *templating logic* and this is where *template strings* get there name from. Here's how you would potentially generate an html string previously:
24+
Another common use case is when you want to generate some string out of some static strings + some variables. For this you would need some *templating logic* and this is where *template strings* get their name from. Here's how you would potentially generate an html string previously:
2525

2626
```ts
2727
var lyrics = 'Never gonna give you up';
@@ -77,6 +77,6 @@ function htmlEscape(literals, ...placeholders) {
7777
For pre ES6 compile targets the code is fairly simple. Multiline strings become escaped strings. String interpolation becomes *string concatenation*. Tagged Templates become function calls.
7878

7979
#### Summary
80-
Multiline strings and string interpolation are just great things to have in any language. Its great that you can now use them in your JavaScript (thanks TypeScript!). Tagged templates allow you to create powerful string utilities.
80+
Multiline strings and string interpolation are just great things to have in any language. It's great that you can now use them in your JavaScript (thanks TypeScript!). Tagged templates allow you to create powerful string utilities.
8181

82-
{% include "footer.md" %}
82+
{% include "footer.md" %}

0 commit comments

Comments
 (0)