Skip to content

Commit d620dc6

Browse files
fix typos
1 parent abe7814 commit d620dc6

17 files changed

+68
-59
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ This book is intended for somebody already familiar with the basics of JavaScrip
2121

2222
Additional chapters cover the new features introduced post ES6 (ES2015) all the way to the most recent version, ES2018.
2323

24-
## Download
25-
2624

2725
## About me
2826

ebook/00_introduction.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Introduction
2+
3+
This book is the sum of all my study on JavaScript throughout the past few months.
4+
As as self-taught web developer I read books, watched tutorials and read articles to keep myself updated to the newest version of JavaScript and while doing so I took several notes.
5+
6+
I have now compiled all these notes in a concise book, covering almost all the new features that have been added to JavaScript since 2015 until 2018.
7+
8+
Writing this book has been a long journey but the end result makes me really proud of having started writing it.
9+
10+
As a self-taught developer I know the importance of sharing knowledge and materials and that is why this book can be read online on my [website](https://www.inspiredwebdev.com/courses/the-complete-guide-to-modern-javascript/) or on [GitHub](https://github.com/AlbertoMontalesi/JavaScript-es6-and-beyond-ebook) where more than 170 people already showed their appreciation for it.
11+
12+
**Disclaimer**
13+
14+
This book is intended for somebody already familiar with the basics of JavaScript, as I am only focusing on the new features introduced by ES6 and I won't be explaining what is a `var`, how to create a function, etc...
15+
16+
Additional chapters cover the new features introduced post ES6 (ES2015) all the way to the most recent version, ES2018.
17+
18+
 
19+
20+
## Contributions & Donations
21+
22+
Any contributions you make are of course greatly appreciated.
23+
24+
If you enjoy my content and you want to donate me a cup of coffee, you can do so [here](https://www.paypal.me/albertomontalesi).
25+
26+
## License
27+
28+
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License</a>.

ebook/01_var_let_const.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ console.log(functionScoped);
2626
// ReferenceError: functionScoped is not defined
2727
```
2828

29-
In the first example the value of the `var` leaked out of the block-scope and could be accessed from outside, whereas in the second example `var` was confined inside a function-scope and we could not access it from outside.
29+
In the first example the value of the `var` leaked out of the block-scope and could be accessed from outside of it, whereas in the second example `var` was confined inside a function-scope and we could not access it from outside.
3030

3131
&nbsp;
3232

@@ -68,7 +68,7 @@ As you can see, when we assigned a new value to our `let` inside our block-scope
6868

6969
## `Const`
7070

71-
Similarly to `let`, `const` are **block-scoped**, but they differ in the fact that their value **can't change through re-assignment or can't be redeclared**.
71+
Similarly to `let`, `const` are **block-scoped**, but they differ in the fact that their value **can't change through re-assignment or can't be re-declared**.
7272

7373

7474
``` javascript
@@ -93,11 +93,13 @@ const person = {
9393
}
9494

9595
person.age = 26;
96-
96+
console.log(person.age);
97+
// 26
9798
// in this case no error will be raised, we are not re-assigning the variable but just one of its properties.
98-
```
99+
```
99100

100101
---
102+
101103
&nbsp;
102104

103105
## The temporal dead zone

ebook/02_arrow_functions.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ ES6 introduced fat arrows (`=>`) as a way to declare functions.
66
This is how we would normally declare a function in ES5:
77

88
``` javascript
9-
var greeting = (function(name) {
9+
var greeting = function(name) {
1010
return "hello " + name;
11-
})
11+
}
1212
```
1313

1414
The new syntax with a fat arrow looks like this:
@@ -35,7 +35,6 @@ const greeting = () => {
3535
}
3636
```
3737

38-
3938
&nbsp;
4039

4140
## Implicitly return
@@ -55,10 +54,9 @@ const runners = [ "Usain Bolt", "Justin Gatlin", "Asafa Powell" ];
5554
const winner = runners.map((runner, i) => ({ name: runner, race, place: i + 1}));
5655

5756
console.log(winner);
58-
// 0: {name: "Usain Bolt", race: "100m dash", place: 1}
59-
// 1: {name: "Justin Gatlin", race: "100m dash", place: 2}
60-
// 2: {name: "Asafa Powell", race: "100m dash", place: 3}
61-
57+
// {name: "Usain Bolt", race: "100m dash", place: 1}
58+
// {name: "Justin Gatlin", race: "100m dash", place: 2}
59+
// {name: "Asafa Powell", race: "100m dash", place: 3}
6260
```
6361

6462
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.
@@ -116,7 +114,7 @@ Since we know that **arrow functions** inherit the value of `this` from the pare
116114
``` javascript
117115
// grab our div with class box
118116
const box = document.querySelector(".box");
119-
// listen for a click event
117+
// listen for a click event
120118
box.addEventListener("click", function () {
121119
// toggle the class opening on the div
122120
this.classList.toggle("opening");
@@ -127,8 +125,7 @@ box.addEventListener("click", function () {
127125
});
128126
```
129127

130-
Here, the second `this` will inherit from its parent, and will be therefore set to the `const` box.
131-
128+
Here, the second `this` will inherit from its parent, and will be set to the `const` box.
132129

133130
&nbsp;
134131

@@ -141,7 +138,7 @@ The next 2 examples all show when to be careful using `this` inside of arrows.
141138
``` javascript
142139
const button = document.querySelector("btn");
143140
button.addEventListener("click", () => {
144-
// error: *this* refers to the window
141+
// error: *this* refers to the `Window` Object
145142
this.classList.toggle("on");
146143
})
147144
```
@@ -150,7 +147,7 @@ button.addEventListener("click", () => {
150147
const person = {
151148
age: 10,
152149
grow: () => {
153-
// error: *this* refers to the window
150+
// error: *this* refers to the `Window` Object
154151
this.age++;
155152
}
156153
}
@@ -183,6 +180,4 @@ const orderRunners = (...args) => {
183180
return `#{runner} was number #{i +1}`;
184181
})
185182
}
186-
187-
```
188-
183+
```

ebook/03_default_function_arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ const Bill = calculatePrice({ tip: 0.15, total:150 });
3535

3636
We don't even have to pass the parameters in the same order as when we declared our function, since we are calling them the same way as the arguments JavaScript will know how to match them.
3737

38-
Don't worry about destructuring, we will talk about it in a later chapter.
38+
Don't worry about destructuring, we will talk about it in Chapter 6.

ebook/04_template_literals.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ const markup = `
142142

143143
&nbsp;
144144

145-
146145
## Tagged template literals
147146

148147
By tagging a function to a template literal we can run the template literal through the function, providing it with everything that's inside of the template.
@@ -171,7 +170,6 @@ console.log(sentence);
171170
We captured the value of the variable age and used a ternary operator to decide what to print.
172171
`strings` will take all the strings of our `let` sentence whilst the other parameters will hold the variables.
173172

174-
175173
&nbsp;
176174

177175
To learn more about use cases of *template literals* check out [this article](https://codeburst.io/javascript-es6-tagged-template-literals-a45c26e54761).

ebook/05_additional_string_methods.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,4 @@ As the name suggests, this new method will repeat what we pass in.
9191
let hello = "Hi";
9292
console.log(hello.repeat(10));
9393
// "HiHiHiHiHiHiHiHiHiHi"
94-
```
95-
94+
```

ebook/06_destructuring.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ MDN defines **destructuring** like this:
66
77
Let's start with **destructuring objects** first.
88

9-
109
&nbsp;
1110

1211
## Destructuring Objects
@@ -95,7 +94,6 @@ console.log(name,surname);
9594

9695
Let's say we want to grab all the other values remaining, we can use the **rest operator**:
9796

98-
9997
```js
10098
const person = ["Alberto", "Montalesi", "pizza", "ice cream", "cheese cake"];
10199
// we use the **rest operator** to grab all the remaining values
@@ -104,14 +102,12 @@ console.log(food);
104102
// Array [ "pizza", "ice cream", "cheese cake" ]
105103
```
106104

107-
108105
&nbsp;
109106

110107
## Swapping variables with destructuring
111108

112109
The destructuring assignment makes it **extremely easy** to swap variables, just look at this example:
113110

114-
115111
```js
116112
let hungry = "yes";
117113
let full = "no";
@@ -136,4 +132,4 @@ function totalBill({ total, tax = 0.1 }) {
136132
// as you see since we are using the same names, we don't have to pass the arguments in the same order as when we declared the function
137133
// we are also overriding the default value we set for the tax
138134
const bill = totalBill({ tax: 0.15, total: 150});
139-
135+
```

ebook/07_iterables-and-looping.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,13 @@ for (const prop of Object.keys(car)){
5858

5959
&nbsp;
6060

61-
6261
## The `for in` loop
6362

6463
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.
6564

6665
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.
6766

68-
It is therefore suggested not to add, modify or delete properties of the object during the iteration as there is no guarantee that they will be visited, or if they will be visited before or after being modified.
69-
67+
It is therefore suggested not to add, modify or delete properties of the object during the iteration as there is no guarantee that they will be visited, or if they will be visited before or after being modified.
7068

7169
```js
7270
const car = {
@@ -101,7 +99,6 @@ for (let i in list) {
10199
for (let i of list) {
102100
console.log(i); // "4", "5", "6"
103101
}
104-
105102
```
106103

107104
`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.

ebook/08_array_improvements.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ console.log(digits);
6969
// Array [ 1, 2, 3, 4, 5];
7070
```
7171

72-
7372
&nbsp;
7473

7574
## `Array.find()`
@@ -125,5 +124,4 @@ console.log(arrayEvery);
125124
// false
126125
```
127126

128-
Simply put, the first condition is true, because there are **some** elements greater than 2, but the second is false because **not every element** is greater than 2.
129-
127+
Simply put, the first condition is true, because there are **some** elements greater than 2, but the second is false because **not every element** is greater than 2.

0 commit comments

Comments
 (0)