You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
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...
8
8
9
-
Additional chapters cover the new features introduced post ES6 all the way to the most recent version, ES9(ES2018).
9
+
Additional chapters cover the new features introduced post ES6 (ES2015) all the way to the most recent version, ES2018.
10
10
11
11
## About me
12
12
@@ -16,7 +16,7 @@ My name is Alberto, I'm from Italy and I love programming. As I was studying ES6
16
16
17
17
Any contributions you make are of course greatly appreciated.
18
18
19
-
If you enjoy my content and you want to donate me a cup of coffee, you can do so [here](https://github.com/AlbertoMontalesi/JavaScript-ES6-for-beginners-ebook/tree/33fc6a922b67c3f7e105bd14b3828b77a67ebdb4/paypal.me/albertomontalesi/README.md).
19
+
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).
Copy file name to clipboardExpand all lines: ebook/01_var_let_const.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,20 @@
1
1
# Chapter 1: Var vs Let vs Const & the temporal dead zone
2
2
3
-
With the introduction of `let` and `const` in **ES6**, we can now better define our variable depending on our needs. Let's have a look at the major differences between them.
3
+
With the introduction of `let` and `const` in **ES6**, we can now better define our variables depending on our needs. Let's have a look at the major differences between them.
4
4
5
5
6
6
7
7
## `Var`
8
8
9
-
`var` are **function scoped**, which means that if we declare them inside a `for` loop (which is a **block** scope) they will be available globally.
9
+
`var` are **function scoped**, which means that if we declare them inside a `for` loop (which is a **block** scope) they will be available even outside of it.
10
10
11
11
```javascript
12
12
for (var i =0; i <10; i++) {
13
-
varglobal="I am available globally";
13
+
varleak="I am available outside of the loop";
14
14
}
15
15
16
-
console.log(global);
17
-
// I am available globally
16
+
console.log(leak);
17
+
// I am available outside of the loop
18
18
19
19
functionmyFunc(){
20
20
var functionScoped ="I am available inside this function";
@@ -26,7 +26,7 @@ console.log(functionScoped);
26
26
// ReferenceError: functionScoped is not defined
27
27
```
28
28
29
-
In the first example the value of the `var`global leaked out of the block-scope and could be accessed from the global scope, 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, whereas in the second example `var` was confined inside a function-scope and we could not access it from outside.
30
30
31
31
32
32
@@ -148,5 +148,3 @@ The second opinion comes from [Kyle Simpson:]( blog.getify.com/constantly-confus
148
148
- Refactor `let` to `const` only after some code has to be written, and you're reasonably sure that you've got a case where there shouldn't be variable reassignment.
149
149
150
150
Which opinion to follow is entirely up to you. As always, do your own research and figure out which one you think is the best.
151
-
152
-
You may want to [read this article](https://medium.com/@sbakkila/javascript-es-6-let-and-the-dreaded-temporal-dead-zone-85b89314d168) to understand how `let` affects your performances compared to `var` before you choose to follow either [Mathias Bynes](https://mathiasbynens.be/notes/es6-const) or [Kyle Simpson](blog.getify.com/constantly-confusing-const/).
Copy file name to clipboardExpand all lines: ebook/18_ES8_string-padding-object-entries-object-values-and-more.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Chapter 18: ES8 string padding, `Object.entries()`, `Object.values()` and more
1
+
# Chapter 18: ES2017 string padding, `Object.entries()`, `Object.values()` and more
2
2
3
-
ES8 (ES2017) introduced many new cool features, which we are going to see here. I will discuss `Async` and `Await` later as they deserve more attention.
3
+
ES2017 introduced many new cool features, which we are going to see here. I will discuss `Async` and `Await` later as they deserve more attention.
Copy file name to clipboardExpand all lines: ebook/20_ES9_what-is-coming.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Chapter 20: ES9 what is coming?
1
+
# Chapter 20: ES2018 what is coming?
2
2
3
-
ES 2018 (ES9) has not been released yet but we can look at the proposals for features that have reached the stage 4 (the final stage) and that will be included in the new upcoming version of ECMAScript.
3
+
ES 2018 has not been released yet but we can look at the proposals for features that have reached the stage 4 (the final stage) and that will be included in the new upcoming version of ECMAScript.
4
4
You can find the list on [github](https://github.com/tc39/proposals/blob/master/finished-proposals.md).
0 commit comments