Skip to content

Commit 3528393

Browse files
committed
English style review - make corrections to day 7
1 parent 4a99be8 commit 3528393

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

day_07.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
## `this` Keyword
2020

21-
Over and over again I see engineers struggling with `this` topic; is so weird!! Long ago I found myself in the same situation, like, being writing code for many years and still ... never took the time to really understand `this` when `this` is one of the most important and powerful features in JavaScript!
22-
Engineers we feel so frustrated about `this` that there's even a joke for `this`!
21+
Over and over again I see engineers struggling with `this` topic; it's so weird!! Long ago I found myself in the same situation, like, writing code for many years and still ... never took the time to really understand `this` when `this` is one of the most important and powerful features in JavaScript!
22+
As engineers, we feel so frustrated about `this` that there's even a joke for `this`!
2323

2424
> JavaScript makes me want to flip the table and say "F*** this shit", but I can never be sure what **`this`** refers to.
2525
26-
The good things came when I took the responsibility of `this` and accepted the guilt was entirely mine.
26+
Things got better when I took the responsibility of `this` and accepted that the blame was entirely mine.
2727

28-
Why this intro? because there are tons of articles regarding `this` but everything about `this` was written by **Kyle Simpson** who dedicated a whole book for `this` topic , so we're gonna read and study it until we breath `this`.
28+
Why this intro? because there are tons of articles regarding `this` but everything about `this` was written by **Kyle Simpson** who dedicated a whole book for `this` topic , so we're gonna read and study it until we breathe `this`.
2929

3030
### Resolving `this`
3131

@@ -53,7 +53,7 @@ Now we've learned that `this` has specific rules and it's resolved at run-time,
5353
- [Function.prototype.apply()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
5454
- [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call)
5555

56-
Now, there's a catch!!! it seems that depending on a thing called **mode**, that depending on it's [strictness](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) or [non-strictness](https://developer.mozilla.org/en-US/docs/Glossary/Sloppy_mode) (a.k.a. Sloppy) it'll alter the semantics and behavior of many things including `this`.
56+
Now, there's a catch!!! it seems that depending on a thing called **mode**, that depending on its [strictness](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) or [non-strictness](https://developer.mozilla.org/en-US/docs/Glossary/Sloppy_mode) (a.k.a. Sloppy) will alter the semantics and behavior of many things including `this`.
5757

5858
---
5959

@@ -71,8 +71,8 @@ Now, there's a catch!!! it seems that depending on a thing called **mode**, that
7171
#### TL;DR
7272

7373
1. Eliminates some JavaScript `silent errors` by changing them `to throw errors`.
74-
2. Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode.
75-
3. Prohibits some syntax likely to be defined in future versions of ECMAScript.
74+
2. Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not in strict mode.
75+
3. Prohibits some syntax likely from be defined in future versions of ECMAScript.
7676

7777
### Semantic differences
7878

@@ -100,7 +100,7 @@ When adding `'use strict';` the following cases will throw an Error:
100100
- Escape characters are not allowed `var y = \010;`
101101
- Declaring function in blocks `if (a < b) { function f() {} }`
102102
- Obvious errors
103-
- Declaring twice the same name for a property name in an object literal `{a: 1, b: 3, a: 7}` This is no longer the case in ECMAScript 2015 (bug 1041128).
103+
- Declaring the same name twice for a property name in an object literal `{a: 1, b: 3, a: 7}` This is no longer the case in ECMAScript 2015 (bug 1041128).
104104
- Declaring two function parameters with the same name function `f(a, b, b) {}`
105105
- TypeError
106106
- Writing to a get-only property is not allowed
@@ -150,7 +150,7 @@ f(); // 6
150150

151151
```
152152

153-
One of the most expected and misused features of ES6 is the Arrow Function. Undoubtedly powerful it might also derive in a headache if you don't really know how they work and which are the differences between the full body notation and the arrow notation.
153+
One of the most expected and misused features of ES6 is the Arrow Function. Undoubtedly powerful, it might also derive in a headache if you don't really know how they work and what the differences are between the full body notation and the arrow notation.
154154

155155
Let's take a look at [YDKJS - ES6 & Beyond - chapter 2](https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/es6%20%26%20beyond/ch2.md#arrow-functions)
156156

@@ -159,7 +159,7 @@ Let's take a look at [YDKJS - ES6 & Beyond - chapter 2](https://github.com/getif
159159
## Generators
160160

161161
So far we've seen (except for the iterators) only **[run-to-completion](https://en.wikipedia.org/wiki/Run_to_completion_scheduling)** examples of code. It means, "the execution won't stop until it's done or fails".
162-
What if I tell you there's a feature that let you define a function capable of being paused midway and resumed later?
162+
What if I tell you there's a feature that lets you define a function capable of being paused midway and resumed later?
163163

164164
Together with [`iterators`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol) ES6 introduced something called `generators`.
165165

0 commit comments

Comments
 (0)