Skip to content

Commit e0f7362

Browse files
author
Sean Arseneault
committed
Fixed typos
1 parent caa7d90 commit e0f7362

16 files changed

+46
-46
lines changed

ebook/03_default_function_arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Notice this detail:
101101
tip = 0.05} = {}
102102
```
103103

104-
If we don't default our argument Object to an empty Object, if we were to try and run `calculatePrice()` we would get:
104+
If we don't default our argument Object to an empty Object, and we were to try and run `calculatePrice()` we would get:
105105

106106
```js
107107
Cannot destructure property `total` of 'undefined' or 'null'.

ebook/04_template_literals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ console.log(greeting);
1616
// Hello my name is Alberto
1717
```
1818

19-
In ES6 we can use backticks to make our life easier.
19+
In ES6 we can use backticks to make our lives easier.
2020

2121
``` javascript
2222
let name = "Alberto";
@@ -99,7 +99,7 @@ return isFridgeEmpty ? "$10" : "20"
9999
// $20
100100
```
101101

102-
If the condition before the `?` can be converted to `true` then the first value is returned, else it's the value after the `:` that get returned.
102+
If the condition before the `?` can be converted to `true` then the first value is returned, else it's the value after the `:` that gets returned.
103103

104104

105105
``` js

ebook/05_additional_string_methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chapter 5: Additional string methods
22

3-
There are many methods that we can use againt strings. Here's a list of a few of them:
3+
There are many methods that we can use against strings. Here's a list of a few of them:
44

55
```js
66
// .length()

ebook/07_iterables-and-looping.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ for (const prop of Object.keys(car)){
5959

6060
## The `for in` loop
6161

62-
Even though it is not a new ES6 loop, let's look at the `for in` loop to understand what differentiate it compared to the `for of`.
62+
Even though it is not a new ES6 loop, let's look at the `for in` loop to understand what differentiates it to the `for of` loop.
6363

6464
The `for in` loop is a bit different because it will iterate over all the [enumerable properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties) of an object in no particular order.
6565

@@ -103,7 +103,7 @@ for (let i of list) {
103103
`for in` will return a list of keys whereas the `for of` will return a list of values of the numeric properties of the object being iterated.
104104

105105

106-
Another differences is that we **can** stop a `for of` loop but we can't do the same with a `for in` loop.
106+
Another difference is that we **can** stop a `for of` loop but we can't do the same with a `for in` loop.
107107

108108
```js
109109
const digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

ebook/08_array_improvements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## `Array.from()`
44

5-
`Array.from()` is the first of the many new array methods that ES6 introduced.
5+
`Array.from()` is the first of many new array methods that ES6 introduced.
66

77
It will take something **arrayish**, meaning something that looks like an array but isn't, and transform it into a real array.
88

ebook/11_symbols.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ console.log(symbols);
8282
// length: 3
8383
```
8484

85-
We retrieved the array but to be able to access the properties we havee to use `map`.
85+
We retrieved the array but to be able to access the properties we have to use `map`.
8686

8787
```js
8888
const symbols = Object.getOwnPropertySymbols(office);

ebook/12_classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const person = class Person {
5353
5454
Let's start creating our first `Class`.
5555

56-
We only need a method called `constructor` (remember to add only one constructor, a `SyntaxError` will be thrown if the class contains more than one constructor methods).
56+
We only need a method called `constructor` (remember to add only one constructor, a `SyntaxError` will be thrown if the class contains more than one constructor method).
5757

5858
``` js
5959
class Person {

ebook/13_promises.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ myPromise
126126

127127
We use `.then()` to grab the value when the promise resolves and `.catch()` when the promise rejects.
128128

129-
If you see our error log you can see that it tells us where the error occured, that is because we wrote `reject(Error("this is our error"));` and not simply `reject("this is our error");`.
129+
Looking at our error log you can see that it tells us where the error occured, that is because we wrote `reject(Error("this is our error"));` and not simply `reject("this is our error");`.
130130

131131
 
132132

133133
### Chaining promises
134134

135-
We can chain promises one after the other, using what was returned from the previous one as the base for the subsequent one, whether the promise resolved or got rejected.
135+
We can chain promises one after the other, using what was returned from the previous one as the base for the subsequent one, whether the promise was resolved or rejected.
136136

137137
``` js
138138
const myPromise = new Promise((resolve, reject) => {
@@ -251,7 +251,7 @@ Our values returned together, after 1000ms (the timeout of the *second* promise)
251251

252252
If we were to pass an empty iterable then it will return an already resolved promise.
253253

254-
If one of the promise was rejected, all of them would asynchronously reject with the value of that rejection, no matter if they resolved.
254+
If one of the promises was rejected, all of them would asynchronously reject with the value of that rejection, even if they resolved.
255255

256256
```js
257257
const promise1 = new Promise((resolve,reject) => {
@@ -261,7 +261,7 @@ const promise2 = new Promise((resolve,reject) => {
261261
reject(Error("oooops error"));
262262
});
263263

264-
// one of the two promise will fail, but `.all` will return only a rejection.
264+
// one of the two promises will fail, but `.all` will return only a rejection.
265265
Promise
266266
.all([promise1, promise2])
267267
.then(data => {
@@ -274,7 +274,7 @@ Promise
274274
// Error: oooops error
275275
```
276276

277-
`Promise.race()` on the other hand returns a promise that resolves or rejects as soon as one of the promises in the iterable resolves or reject, with the value from that promise.
277+
`Promise.race()` on the other hand returns a promise that resolves or rejects as soon as one of the promises in the iterable resolves or rejects, with the value from that promise.
278278

279279
``` js
280280
const promise1 = new Promise((resolve,reject) => {
@@ -291,4 +291,4 @@ Promise.race([promise1, promise2]).then(function(value) {
291291
// expected output: "second value"
292292
```
293293

294-
If we passed an empty iterable, the race would be pending forever!.
294+
If we passed an empty iterable, the race would be pending forever!

ebook/14_generators.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,22 @@ const fruitList = ['Banana','Apple','Orange','Melon','Cherry','Mango'];
4949
// create our looping generator
5050
function* loop(arr) {
5151
for (const item of arr) {
52-
yield `I like to eat ${item}`;
52+
yield `I like to eat ${item}s`;
5353
}
5454
}
5555

5656

5757
const fruitGenerator = loop(fruitList);
5858
fruitGenerator.next();
59-
// Object { value: "I like to eat Banana", done: false }
59+
// Object { value: "I like to eat Bananas", done: false }
6060
fruitGenerator.next();
61-
// Object { value: "I like to eat Apple", done: false }
61+
// Object { value: "I like to eat Apples", done: false }
6262
fruitGenerator.next().value;
63-
// "I like to eat Orange"
63+
// "I like to eat Oranges"
6464
```
6565

66-
- Our new generator will loop over the array and print one value at a time every time we call `.next()`.
67-
- if you are only concerned about getting the value, then use `.next().value` and it will not print the status of the generator
66+
- Our new generator will loop over the array and print one value at a time every time we call `.next()`
67+
- If you are only concerned about getting the value, then use `.next().value` and it will not print the status of the generator
6868

6969
 
7070

@@ -113,21 +113,21 @@ myGenerator.throw("ooops");
113113
// Object { value: undefined, done: true }
114114
```
115115

116-
As you can see when we called `.throw()` the `generator` returned us the error and finished even though we still had one more `yield` to execute.
116+
As you can see when we called `.throw()` the `generator` returned us the error and finished even though we still had one more `yield` to execute.
117117

118118
 
119119

120120
## Combining Generators with Promises
121121

122-
As we have previously seen, Promises are very useful for asynchronous programming, and by combining them with generators we can have a very powerful tool at our disposal to avoid problems like the *callback hell*.
122+
As we have previously seen, Promises are very useful for asynchronous programming, and by combining them with generators we have a very powerful tool at our disposal to avoid problems like the *callback hell*.
123123

124-
As we are solely discussing ES6, I won't be talking about async functions as they were introduce in ES2017 but know that the way they work is based on what you will see now.
124+
As we are solely discussing ES6, I won't be talking about async functions as they were introduced in ES2017, but know that the way they work is based on what you will see now.
125125

126126
You can read more about async functions in Chapter 19.
127127

128-
Using a Generator in combination with a `Promise` will allow us to write asynchronous code that feels like synchronous.
128+
Using a Generator in combination with a `Promise` will allow us to write asynchronous code that feels like synchronous code.
129129

130-
What we want to do is to wait for a promise to resolve and then pass the resolved value back into our generator in the `.next()` call.
130+
What we want to do is wait for a promise to resolve and then pass the resolved value back into our generator in the `.next()` call.
131131

132132
``` js
133133
const myPromise = () => new Promise((resolve) => {
@@ -142,7 +142,7 @@ function* gen() {
142142
yield result + ' 2';
143143
};
144144

145-
// Call the async function and pass params.
145+
// Call the async function and pass params
146146
const asyncFunc = gen();
147147
asyncFunc.next();
148148
// call the promise and wait for it to resolve

ebook/15_proxies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var x = new Proxy(target,handler)
1717
```
1818

1919
- our `target` can be anything, from an object, to a function, to another `Proxy`
20-
- a `handler` is an object which will define the behavior of our `Proxy` when an operation is performed on it.
20+
- a `handler` is an object which will define the behavior of our `Proxy` when an operation is performed on it
2121

2222
``` js
2323
// our object

0 commit comments

Comments
 (0)