Skip to content

Commit 721081b

Browse files
authored
Merge pull request #708 from iliakan/imidom-patch-1
Update 03-strict-mode for style / grammar
2 parents 5aba914 + e323d3a commit 721081b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# The modern mode, "use strict"
22

3-
For a long time JavaScript was evolving without compatibility issues. New features were added to the language, but the old functionality did not change.
3+
For a long time, JavaScript evolved without compatibility issues. New features were added to the language while old functionality didn't change.
44

5-
That had the benefit of never breaking existing code. But the downside was that any mistake or an imperfect decision made by JavaScript creators got stuck in the language forever.
5+
That had the benefit of never breaking existing code. But the downside was that any mistake or an imperfect decision made by JavaScript's creators got stuck in the language forever.
66

7-
It had been so until 2009 when ECMAScript 5 (ES5) appeared. It added new features to the language and modified some of the existing ones. To keep the old code working, most modifications are off by default. One needs to enable them explicitly with a special directive `"use strict"`.
7+
This was the case until 2009 when ECMAScript 5 (ES5) appeared. It added new features to the language and modified some of the existing ones. To keep the old code working, most modifications are off by default. You need to explicitly enable them with a special directive: `"use strict"`.
88

99
## "use strict"
1010

11-
The directive looks like a string: `"use strict"` or `'use strict'`. When it is located on the top of the script, then the whole script works the "modern" way.
11+
The directive looks like a string: `"use strict"` or `'use strict'`. When it is located at the top of a script, the whole script works the "modern" way.
1212

13-
For example
13+
For example:
1414

1515
```js
1616
"use strict";
@@ -21,17 +21,17 @@ For example
2121

2222
We will learn functions (a way to group commands) soon.
2323

24-
Looking ahead let's just note that `"use strict"` can be put at the start of a function (most kinds of functions) instead of the whole script. Then strict mode is enabled in that function only. But usually people use it for the whole script.
24+
Looking ahead, let's just note that `"use strict"` can be put at the start of most kinds of functions instead of the whole script. Doing that enables strict mode in that function only. But usually, people use it for the whole script.
2525

2626

2727
````warn header="Ensure that \"use strict\" is at the top"
28-
Please make sure that `"use strict"` is on the top of the script, otherwise the strict mode may not be enabled.
28+
Please make sure that `"use strict"` is at the top of your scripts, otherwise strict mode may not be enabled.
2929
30-
There is no strict mode here:
30+
Strict mode isn't enabled here:
3131
3232
```js no-strict
3333
alert("some code");
34-
// "use strict" below is ignored, must be on the top
34+
// "use strict" below is ignored--it must be at the top
3535
3636
"use strict";
3737
@@ -42,20 +42,20 @@ Only comments may appear above `"use strict"`.
4242
````
4343

4444
```warn header="There's no way to cancel `use strict`"
45-
There is no directive `"no use strict"` or alike, that would return the old behavior.
45+
There is no directive like `"no use strict"` that reverts the engine to old behavior.
4646

47-
Once we enter the strict mode, there's no return.
47+
Once we enter strict mode, there's no return.
4848
```
4949
5050
## Always "use strict"
5151
52-
The differences of `"use strict"` versus the "default" mode are still to be covered.
52+
We have yet to cover the differences between strict mode and the "default" mode.
5353
54-
In the next chapters, as we learn language features, we'll make notes about the differences of the strict and default mode. Luckily, there are not so many. And they actually make our life better.
54+
In the next chapters, as we learn language features, we'll note the differences between the strict and default modes. Luckily, there aren't many and they actually make our lives better.
5555
56-
At this point in time it's enough to know about it in general:
56+
For now, it's enough to know about it in general:
5757
58-
1. The `"use strict"` directive switches the engine to the "modern" mode, changing the behavior of some built-in features. We'll see the details as we study.
59-
2. The strict mode is enabled by `"use strict"` at the top. Also there are several language features like "classes" and "modules" that enable strict mode automatically.
60-
3. The strict mode is supported by all modern browsers.
61-
4. It's always recommended to start scripts with `"use strict"`. All examples in this tutorial assume so, unless (very rarely) specified otherwise.
58+
1. The `"use strict"` directive switches the engine to the "modern" mode, changing the behavior of some built-in features. We'll see the details later in the tutorial.
59+
2. Strict mode is enabled by placing `"use strict"` at the top of a script or function. Several language features, like "classes" and "modules", enable strict mode automatically.
60+
3. Strict mode is supported by all modern browsers.
61+
4. We recommended always starting scripts with `"use strict"`. All examples in this tutorial assume strict mode unless (very rarely) specified otherwise.

0 commit comments

Comments
 (0)