Skip to content

Commit 6daaf97

Browse files
Performs Markdown Lint and Spell Check
1 parent 005d6e1 commit 6daaf97

14 files changed

+63
-65
lines changed

ebook/01_var_let_const.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ As you can see, when we assigned a new value to our `let` inside our block-scope
7070

7171
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

73-
7473
``` javascript
7574
const constant = 'I am a constant';
7675
constant = " I can't be reassigned";
@@ -100,7 +99,7 @@ In this case we are not reassigning the whole variable but just one of its prope
10099

101100
---
102101

103-
Note: We can still freeze the const object, which will not change the contents of the object (but trying to change the values of object Javascript will not throw any error)
102+
Note: We can still freeze the const object, which will not change the contents of the object (but trying to change the values of object JavaScript will not throw any error)
104103

105104
``` javascript
106105
const person = {
@@ -160,7 +159,6 @@ The first opinion comes from [Mathias Bynes:](https://mathiasbynens.be/notes/es6
160159
- use `let` only if rebinding is needed.
161160
- `var` should never be used in ES6.
162161

163-
164162
The second opinion comes from [Kyle Simpson:](https://me.getify.com/)
165163

166164
- Use `var` for top-level variables that are shared across many (especially larger) scopes.

ebook/02_arrow_functions.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const arrowFunction = name => `hello ${name}`;
5656
```
5757

5858
Both functions achieve the same result, but the new syntax allows you to be more concise.
59-
Beware! Readability is more important than conciseness so you might want to write your funciton like this if you are working in a team and not everybody is totally up-to-date with ES6.
59+
Beware! Readability is more important than conciseness so you might want to write your function like this if you are working in a team and not everybody is totally up-to-date with ES6.
6060

6161
```js
6262
const arrowFunction = (name) => {
@@ -106,10 +106,10 @@ When you use an arrow function, the `this` keyword is inherited from the parent
106106

107107
This can be useful in cases like this one:
108108

109-
``` javascript
109+
``` javascript
110110
// grab our div with class box
111111
const box = document.querySelector(".box");
112-
// listen for a click event
112+
// listen for a click event
113113
box.addEventListener("click", function() {
114114
// toggle the class opening on the div
115115
this.classList.toggle("opening");
@@ -120,11 +120,10 @@ box.addEventListener("click", function() {
120120
});
121121
```
122122

123-
124123
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:
125124

126125
``` javascript
127-
Uncaught TypeError: cannot read property "toggle" of undefined
126+
Uncaught TypeError: cannot read property "toggle" of undefined
128127
```
129128

130129
Since we know that **arrow functions** inherit the value of `this` from the parent scope, we can re-write our function like this:

ebook/03_default_function_arguments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ If we don't default our argument Object to an empty Object, and we were to try a
108108
Cannot destructure property `total` of 'undefined' or 'null'.
109109
```
110110

111-
By writing ` = {}` we default our argument to an `Object` and no matter what argument we pass in the function, it will be an `Object`:
111+
By writing `= {}` we default our argument to an `Object` and no matter what argument we pass in the function, it will be an `Object`:
112112
113-
``` js
113+
```js
114114
calculatePrice({});
115115
// 0
116116
calculatePrice();

ebook/04_template_literals.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ how are you?\ "
6464

6565
In ES6 we simply have to wrap everything inside backticks, no more backslashes on each line.
6666

67-
``` javascript
67+
``` javascript
6868
const content = `hello,
6969
my name is Alberto
7070
how are you?`;
@@ -101,7 +101,6 @@ return isFridgeEmpty ? "$10" : "$20"
101101

102102
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

104-
105104
``` js
106105
// create an artist with name and age
107106
const artist = {
@@ -148,7 +147,7 @@ const groceries = {
148147
// this function will map each individual value of our groceries
149148
function groceryList(others) {
150149
return `
151-
<p>
150+
<p>
152151
${others.map( other => ` <span> ${other}</span>`).join(' ')}
153152
</p>
154153
`;

ebook/05_additional_string_methods.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,53 @@
22

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

5-
1. **indexOf()**
6-
7-
Gets the position of the first occurence of the specified value in a string.
8-
```js
9-
const str = "this is a short sentence";
10-
str.indexOf("short");
11-
// Output: 10
12-
```
13-
2. **slice()**
14-
15-
Pulls a specified part of a string as a new string.
16-
```js
17-
const str = "pizza, orange, cereals"
18-
str.slice(0, 5);
19-
// Output: "pizza"
20-
```
21-
3. **toUpperCase()**
22-
23-
Turns all characters of a string to uppercase.
24-
```js
25-
const str = "i ate an apple"
26-
str.toUpperCase()
27-
// Output: "I ATE AN APPLE"
28-
```
29-
4. **toLowerCase()**
30-
31-
Turns all characters of a string to lowercase.
32-
```
33-
const str = "I ATE AN APPLE"
34-
str.toLowerCase()
35-
// Output: "i ate an apple"
36-
```
5+
1. **indexOf()**
6+
7+
Gets the position of the first occurrence of the specified value in a string.
8+
9+
```js
10+
const str = "this is a short sentence";
11+
str.indexOf("short");
12+
// Output: 10
13+
```
14+
15+
2. **slice()**
16+
17+
Pulls a specified part of a string as a new string.
18+
19+
```js
20+
const str = "pizza, orange, cereals"
21+
str.slice(0, 5);
22+
// Output: "pizza"
23+
```
24+
25+
1. **toUpperCase()**
26+
27+
Turns all characters of a string to uppercase.
28+
29+
```js
30+
const str = "i ate an apple"
31+
str.toUpperCase()
32+
// Output: "I ATE AN APPLE"
33+
```
34+
35+
4. **toLowerCase()**
36+
37+
Turns all characters of a string to lowercase.
38+
39+
```JS
40+
const str = "I ATE AN APPLE"
41+
str.toLowerCase()
42+
// Output: "i ate an apple"
43+
```
3744

3845
There are many more methods, these were just a few as a reminder. Check the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#) for a more in-depth description on the above methods.
3946

4047
&nbsp;
4148

4249
## Additional string methods
4350

44-
ES6 intoduced 4 new string methods:
51+
ES6 introduced 4 new string methods:
4552

4653
- `startsWith()`
4754
- `endsWith()`

ebook/06_destructuring.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const { facebook } = person.links.social;
5454

5555
We are not limited to name our variable the same as the property of the object, we can also rename it like this:
5656

57-
5857
```js
5958
const { facebook:fb } = person.links.social;
6059
// it will look for the property person.links.social.facebook and name the variable fb

ebook/08_array_improvements.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ In the example above we passed a `map` function to the `.from()` method to push
6666

6767
`Array.of()` will create an array with all the arguments we pass into it.
6868

69-
7069
```js
7170
const digits = Array.of(1,2,3,4,5);
7271
console.log(digits);

ebook/11_symbols.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ They both have the same value, but we will never have naming collisions with Sym
3333

3434
As we mentioned earlier we can use them to create identifiers for object properties, so let's see an example:
3535

36-
``` js
36+
``` js
3737
const office = {
3838
"Tom" : "CEO",
3939
"Mark": "CTO",
@@ -94,4 +94,4 @@ console.log(value);
9494
// length: 3
9595
```
9696

97-
Now we finally got the array containing all the values of our symbols.
97+
Now we finally got the array containing all the values of our symbols.

ebook/12_classes.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Quoting MDN:
44
> classes are primarily syntactical sugar over js's existing prototype-based inheritance. The class syntax **does not** introduce a new object-oriented inheritance model to JavaScript.
55
6-
76
That being said, let's review prototypal inheritance before we jump into classes.
87

98
``` js
@@ -83,7 +82,7 @@ As you can see everything works just like before. As we mentioned at the beginni
8382

8483
## Static methods
8584

86-
Right now the two new methods that we created, `greet()` and `farewell()` can be accessed by every new instance of `Person`, but what if we want a method that can only be accessed by the class itself, similarily to `Array.of()` for arrays?
85+
Right now the two new methods that we created, `greet()` and `farewell()` can be accessed by every new instance of `Person`, but what if we want a method that can only be accessed by the class itself, similarly to `Array.of()` for arrays?
8786

8887
```js
8988
static info(){
@@ -135,7 +134,6 @@ alberto.nicknames;
135134

136135
What if we want to have a new `Class` that inherits from our previous one? We use `extends`:
137136

138-
139137
``` js
140138
// our initial class
141139
class Person {
@@ -179,7 +177,7 @@ class Adult extends Person {
179177
}
180178
```
181179

182-
Why did we set `super(name,age)` ? Because our `Adult` class inherits name and age from the `Person` therefore we don't need to redeclare them.
180+
Why did we set `super(name,age)` ? Because our `Adult` class inherits name and age from the `Person` therefore we don't need to redeclare them.
183181
Super will simply create a new Person for us.
184182

185183
If we now run the code again we will get this:
@@ -203,7 +201,7 @@ We want to create something like this, something similar to an array where the f
203201

204202
``` js
205203
// we create a new Classroom
206-
const myClass = new Classroom('1A',[
204+
const myClass = new Classroom('1A',[
207205
{name: "Tim", mark: 6},
208206
{name: "Tom", mark: 3},
209207
{name: "Jim", mark: 8},
@@ -221,12 +219,12 @@ class Classroom extends Array {
221219
super(...students);
222220
this.name = name;
223221
// we create a new method to add students
224-
}
222+
}
225223
add(student){
226224
this.push(student);
227225
}
228226
}
229-
const myClass = new Classroom('1A',
227+
const myClass = new Classroom('1A',
230228
{name: "Tim", mark: 6},
231229
{name: "Tom", mark: 3},
232230
{name: "Jim", mark: 8},

ebook/13_promises.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fs.readdir(source, function (err, files) {
5252

5353
We try to write our code in a way where executions happens visually from top to bottom, causing excessive nesting on functions and result in what you can see above.
5454

55-
To improve your callbacks you can check out http://callbackhell.com/
55+
To improve your callbacks you can check out [http://callbackhell.com/](http://callbackhell.com/)
5656

5757
Here we will focus on how to write promises.
5858

@@ -191,7 +191,7 @@ We did not get "first value" because we threw an error therefore we only got the
191191
```js
192192
//Promise.resolve()
193193
Promise.resolve('Success').then(function(value) {
194-
console.log(value);
194+
console.log(value);
195195
// "Success"
196196
}, function(value) {
197197
// not called

0 commit comments

Comments
 (0)