Skip to content

Commit 1066cb7

Browse files
Merge pull request #13 from itsmesean/master
Fixed typos
2 parents 69ce529 + 383caaa commit 1066cb7

19 files changed

+53
-55
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Whether you are a complete beginner or you have some knowledge in JavaScript, th
2121

2222
After reading this book, Let Const, generators, promises and async won't be a problem anymore.
2323

24-
If you want to experience something new, this book also includes an introduction to the basics of TypeScript, a must-know for any JavaScript develop in 2019.
24+
If you want to experience something new, this book also includes an introduction to the basics of TypeScript, a must-know for any JavaScript developer in 2019.
2525

2626
## Where to buy it
2727

2828
You can purchase this ebook on amazon.com at this [link](https://www.amazon.com/dp/B07S2M3FVV)
2929

3030
You can also read my articles on my blog [here](https://www.inspiredwebdev.com/).
3131

32-
The ebook includes two sections dedicated to the basics of JavaScript and TypeScript and also contains 50+ extra quizzes for your to practice and test your knowledge after reading each chapter.
32+
The ebook includes two sections dedicated to the basics of JavaScript and TypeScript and also contains 50+ extra quizzes for you to practice and test your knowledge after reading each chapter.
3333
You can have a look at the quizzes from the first two chapters in the `quizzes` folder.
3434

3535
## About me

ebook/01_var_let_const.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,10 @@ In this case we are not reassigning the whole variable but just one of its prope
104104

105105
## The temporal dead zone
106106

107-
Now we will have a look at a very important concept which may sound complicate from its name, but i reassure you it is not.
107+
Now we will have a look at a very important concept which may sound complicated from its name, but I assure you it is not.
108108

109109
First let's have a look at a simple example:
110110

111-
Let's look at an example:
112-
113111
```javascript
114112
console.log(i);
115113
var i = "I am a variable";
@@ -143,7 +141,7 @@ The first opinion comes from [Mathias Bynes:](https://mathiasbynens.be/notes/es6
143141
- `var` should never be used in ES6.
144142

145143

146-
The second opinion comes from [Kyle Simpson:]( blog.getify.com/constantly-confusing-const/)
144+
The second opinion comes from [Kyle Simpson:](https://me.getify.com/)
147145

148146
- Use `var` for top-level variables that are shared across many (especially larger) scopes.
149147
- Use `let` for localized variables in smaller scopes.

ebook/02_arrow_functions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ console.log(results);
7878
// {name: "Asafa Powell", race: "100m dash", place: 3}]
7979
```
8080

81-
To tell JavaScript that what's inside the curly braces is an **object literal** that we want to implicitly return, we need to wrap everything inside parenthesis.
81+
To tell JavaScript what's inside the curly braces is an **object literal** we want to implicitly return, we need to wrap everything inside parenthesis.
8282

8383
Writing `race` or `race: race` is the same.
8484

@@ -121,7 +121,7 @@ box.addEventListener("click", function() {
121121
```
122122

123123

124-
The problem in this case is that the first `this` is bound to the `const` box but the second one, inside the `setTimeout`, will be set to the `Window` object, trowing this error:
124+
The problem in this case is that the first `this` is bound to the `const` box but the second one, inside the `setTimeout`, will be set to the `Window` object, throwing this error:
125125

126126
``` javascript
127127
Uncaught TypeError: cannot read property "toggle" of undefined
@@ -187,7 +187,7 @@ example(1,2,3);
187187

188188
As you can see we accessed the first argument using an array notation `arguments[0]`.
189189

190-
Similarly as what we saw with the `this` keyword, Arrow functions inherit the value of the `arguments object` from their parent scope.
190+
Similarly to what we saw with the `this` keyword, Arrow functions inherit the value of the `arguments object` from their parent scope.
191191

192192
Let's have a look at this example with our previous list of runners:
193193

ebook/03_default_function_arguments.md

+1-1
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

+2-2
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

+1-1
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

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+6-6
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

+12-12
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

+1-1
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

ebook/16_sets_weaksets_maps_weakmaps.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ console.log(family);
2626
// Set [ "Dad", "Mom", "Son" ]
2727
```
2828

29-
As you can see, at the end we tried to add "Dad" again,but the `Set` still remained the same because a `Set` can only take **unique values**.
29+
As you can see, at the end we tried to add "Dad" again, but the `Set` still remained the same because a `Set` can only take **unique values**.
3030

3131
Let's continue using the same `Set` and see what methods we can use on it.
3232

@@ -49,7 +49,7 @@ family;
4949

5050
As you can see a `Set` has a `size` property and we can `delete` an item from it or use `clear` to delete all the items from it.
5151

52-
We can also notice that a `Set` does not have keys so when we call `.keys()` we get the same as calling `.values()` or `.entries()`.
52+
We can also notice that a `Set` does not have keys, so when we call `.keys()` we get the same result as calling `.values()` or `.entries()`.
5353

5454
 
5555

@@ -137,7 +137,7 @@ As you can see after a few seconds **dad** was removed and *garbage collected*.
137137

138138
## What is a `Map`?
139139

140-
A `Map` is similar to a `Set`, but they have key and value pairs.
140+
A `Map` is similar to a `Set`, but they have key/value pairs.
141141

142142
```js
143143
const family = new Map();

ebook/17_ES2016_incudes-and-exponential-operator.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chapter 17: Everything new in ES2016
22

3-
ES2016 introduced only two new features :
3+
ES2016 introduced only two new features:
44

55
- `Array.prototype.includes()`
66
- The exponential operator
@@ -24,7 +24,7 @@ array.includes(3);
2424

2525
### Combine `includes()` with `fromIndex`
2626

27-
We can provide `.includes()` with an index where to begin searching for an element. Default is 0, but we can also pass a negative value.
27+
We can provide `.includes()` with an index to begin searching for an element. Default is 0, but we can also pass a negative value.
2828

2929
The first value we pass in is the element to search and the second one is the index:
3030

@@ -43,7 +43,7 @@ array.includes(11,-3);
4343
// true
4444
```
4545

46-
`array.includes(5,4);` returned `false` because, despite the array actually contains the number 5, it is found at the index 2 but we started looking at position 4. That's why we couldn't find it and it returned `false`.
46+
`array.includes(5,4);` returned `false` because, despite the array actually containing the number 5, it is found at the index 2 but we started looking at position 4. That's why we couldn't find it and it returned `false`.
4747

4848
`array.includes(1,-1);` returned `false` because we started looking at the index -1 (which is the last element of the array) and then continued from that point onward.
4949

ebook/18_ES2017_string-padding-object-entries-object-values-and-more.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chapter 18: ES2017 string padding, `Object.entries()`, `Object.values()` and more
22

3-
ES2017 introduced many new cool features, which we are going to see here.
3+
ES2017 introduced many cool new features, which we are going to see here.
44

55
## String padding (`.padStart()` and `.padEnd()`)
66

@@ -13,8 +13,8 @@ We can now add some padding to our strings, either at the end (`.padEnd()`) or a
1313
// "hello "
1414
```
1515

16-
We specified that we want 6 as our padding, but why in both cases we got only 1 space?
17-
It happens because `padStart` and `padEnd` will go and fill the **empty spaces**. In our example "hello" is 5 letters, and our padding is 6, which leaves only 1 empty space.
16+
We specified that we want 6 as our padding, so then why in both cases did we only get 1 space?
17+
It happened because `padStart` and `padEnd` will go and fill the **empty spaces**. In our example "hello" is 5 letters, and our padding is 6, which leaves only 1 empty space.
1818

1919
Look at this example:
2020

@@ -85,7 +85,7 @@ family.father;
8585
"Jonathan Kent"
8686
```
8787

88-
`Object.keys()` returned us only the keys of the object that we then had to use to access the values.
88+
`Object.keys()` returned only the keys of the object that we then had to use to access the values.
8989

9090
We now have two more ways of accessing our objects:
9191

@@ -145,7 +145,7 @@ const object = {
145145
```
146146

147147
Notice how I wrote a comma at the end of the second property.
148-
It will not throw any error if you don't put it, but it's a better practice to follow as it will make the life easier to your colleague or team members.
148+
It will not throw any error if you don't put it, but it's a better practice to follow as it will make your colleague or team members life easier.
149149

150150
```js
151151
// I write

ebook/19_ES2017_async-and-await.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Let's break down what we just did:
109109
- to create an `async` function we need to put the `async` keyword in front of it
110110
- the keyword will tell JavaScript to always return a promise
111111
- if we specify to `return <non-promise>` it will return a value wrapped inside a promise
112-
- the `await` keyword **only** works inside an `async` function.
112+
- the `await` keyword **only** works inside an `async` function
113113
- as the name implies, `await` will tell JavaScript to wait until the promise returns its result
114114

115115
Let's see what happens if we try to use `await` outside an `async` function
@@ -153,7 +153,7 @@ asyncFunc();
153153
// TypeError: failed to fetch
154154
```
155155

156-
We use `try...catch` to grab the error, but in a case where we do not have them we can still catch the error like this:
156+
We use `try...catch` to grab the error, but in a case where we do not have them we can still catch the error like this:
157157

158158
``` js
159159
async function asyncFunc(){

0 commit comments

Comments
 (0)