Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5f10d6

Browse files
committed
Update README.md
1 parent 35b32e3 commit e5f10d6

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

Week2/README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ These are the topics for week 2:
1414

1515
## 1. JavaScript Versions
1616

17-
You are undoubtably different than when you were a baby. Back then you couldn't really do much: crying, laughing and taking dumps. That's pretty much it. But as the years pass you increasingly could do more and more: walking, socializing or playing an instrument.
17+
You are undoubtedly different than when you were a baby. Back then you couldn't do much except crying. That's pretty much it. But as the years pass you increasingly could do more and more: walking, socializing or playing an instrument.
1818

1919
Likewise, so has JavaScript evolved. Throughout the course you have, unknowingly, used syntax from different JavaScript versions. For example, if you've ever declared a function like this:
2020

@@ -30,7 +30,7 @@ But if you've ever used `arrow` functions (which you'll learn more about in the
3030

3131
That's good and all, but why is this important to differentiate? There are several reasons:
3232

33-
- Each feature (and its updates) of a language is made to solve a specific problem. It's important to know the context and purpose of each in order to know how to use it
33+
- Each feature (and its updates) of a language is made to solve a specific problem. It's important to know the context and purpose of each to know how to use it
3434
- Software is always evolving. This means that there are different versions that different users might be using. This means not every feature will work for every application.
3535

3636
That's why it's important to know a little about the history of JavaScript: it will make you think of JavaScript (and hopefully software in general) as a continually evolving thing, as opposed to "just a bunch of concepts and techniques you need to memorize".
@@ -67,11 +67,30 @@ One of a programmer's favorite things to do is to write clean and concise code.
6767
It is written like this:
6868

6969
```js
70+
const numbers = [2,3,7,8];
71+
72+
//classical way
73+
function isBiggerThanFive(number) {
74+
if ( number > 5 )
75+
return true;
76+
else
77+
return false;
78+
}
79+
console.log(numbers.filter(isBiggerThanFive))
80+
7081
// Arrow function
71-
() => {};
82+
console.log(numbers.filter((number) => {
83+
if ( number > 5 )
84+
return true;
85+
else
86+
return false;
87+
}))
88+
89+
// or even shorter, if one arguments no need for (), if return statement no need for {}
90+
console.log(numbers.filter(number => number > 5));
7291
```
7392

74-
Go through the following resources to learn more about why they're important:
93+
Go through the following resources to learn more about why arrow functions are important:
7594

7695
- [JavaScript ES6 Arrow Functions](https://www.youtube.com/watch?v=h33Srr5J9nY)
7796
- [Let's learn ES6 - Arrow functions](https://www.youtube.com/watch?v=oTRujqZYhrU)
@@ -81,7 +100,7 @@ Go through the following resources to learn more about why they're important:
81100

82101
In JavaScript, like in any other programming language you'll find, there are certain special keywords that always create a specific effect. The `this` keyword is one of those.
83102

84-
In everyday communication we use words like "this" or "that" whenever we want to refer to things in the world or something someone said. It's similarly used in JavaScript.
103+
In everyday communication, we use words like "this" or "that" whenever we want to refer to things in the world or something someone said. It's similarly used in JavaScript.
85104

86105
Simply put: `this` refers to any object it's defined in. The global object, `window` is the default value of `this`. However, anything a new object is created will have its own `this` value.
87106

@@ -98,7 +117,7 @@ Now as we've learned in the previous sections, JavaScript as a language evolves
98117

99118
One of those features added to browsers is an upgraded version of the XHR object. It's called `fetch` and it's the modern way to make API calls. It incorporates Promises, making it easier to handle your server responses.
100119

101-
A `fetch` function is now provided in the global `window` scope in the browser. You can check it out by opening your developers tools and searching for `fetch`. Keep in mind that this only counts for certain browser version. To figure out which browsers can use fetch, check [this](https://caniuse.com/#feat=fetch) out.
120+
A `fetch` function is now provided in the global `window` scope in the browser. You can check it out by opening your developers tools and searching for `fetch`. Keep in mind that `fetch` only works on newer browser version. To figure out which browsers can use fetch, check [this](https://caniuse.com/#feat=fetch) out.
102121

103122
Learn more about `fetch`:
104123

0 commit comments

Comments
 (0)