Skip to content

Commit dde5fed

Browse files
committed
minor fixes
1 parent e4e6a50 commit dde5fed

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

1-js/02-first-steps/09-comparison/article.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ In JavaScript they are written like this:
99
- Equals: `a == b`, please note the double equality sign `=` means the equality test, while a single one `a = b` means an assignment.
1010
- Not equals. In maths the notation is <code>&ne;</code>, but in JavaScript it's written as <code>a != b</code>.
1111

12-
In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.
12+
In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.
13+
14+
At the end you'll find a good recipe to avoid "javascript quirks"-related issues.
1315

1416
## Boolean is the result
1517

@@ -24,7 +26,7 @@ For example:
2426
alert( 2 > 1 ); // true (correct)
2527
alert( 2 == 1 ); // false (wrong)
2628
alert( 2 != 1 ); // true (correct)
27-
```
29+
```
2830

2931
A comparison result can be assigned to a variable, just like any value:
3032

@@ -196,13 +198,12 @@ We get these results because:
196198
- Comparisons `(1)` and `(2)` return `false` because `undefined` gets converted to `NaN` and `NaN` is a special numeric value which returns `false` for all comparisons.
197199
- The equality check `(3)` returns `false` because `undefined` only equals `null`, `undefined`, and no other value.
198200

199-
### Evade problems
200-
201-
Why did we go over these examples? Should we remember these peculiarities all the time? Well, not really. Actually, these tricky things will gradually become familiar over time, but there's a solid way to evade problems with them:
201+
### Avoid problems
202202

203-
Just treat any comparison with `undefined/null` except the strict equality `===` with exceptional care.
203+
Why did we go over these examples? Should we remember these peculiarities all the time? Well, not really. Actually, these tricky things will gradually become familiar over time, but there's a solid way to avoid problems with them:
204204

205-
Don't use comparisons `>= > < <=` with a variable which may be `null/undefined`, unless you're really sure of what you're doing. If a variable can have these values, check for them separately.
205+
- Treat any comparison with `undefined/null` except the strict equality `===` with exceptional care.
206+
- Don't use comparisons `>= > < <=` with a variable which may be `null/undefined`, unless you're really sure of what you're doing. If a variable can have these values, check for them separately.
206207

207208
## Summary
208209

1-js/13-modules/01-modules-intro/article.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
# Modules, introduction
33

4-
As our application grows bigger, we want to split it into multiple files, so called "modules". A module usually contains a class or a library of functions.
4+
As our application grows bigger, we want to split it into multiple files, so called "modules". A module may contain a class or a library of functions for a specific purpose.
55

66
For a long time, JavaScript existed without a language-level module syntax. That wasn't a problem, because initially scripts were small and simple, so there was no need.
77

88
But eventually scripts became more and more complex, so the community invented a variety of ways to organize code into modules, special libraries to load modules on demand.
99

10-
For instance:
10+
To name some (for historical reasons):
1111

1212
- [AMD](https://en.wikipedia.org/wiki/Asynchronous_module_definition) -- one of the most ancient module systems, initially implemented by the library [require.js](http://requirejs.org/).
1313
- [CommonJS](http://wiki.commonjs.org/wiki/Modules/1.1) -- the module system created for Node.js server.
1414
- [UMD](https://github.com/umdjs/umd) -- one more module system, suggested as a universal one, compatible with AMD and CommonJS.
1515

1616
Now all these slowly become a part of history, but we still can find them in old scripts.
1717

18-
The language-level module system appeared in the standard in 2015, gradually evolved since then, and is now supported by all major browsers and in Node.js. So we'll study it from now on.
18+
The language-level module system appeared in the standard in 2015, gradually evolved since then, and is now supported by all major browsers and in Node.js. So we'll study the modern modules from now on.
1919

2020
## What is a module?
2121

22-
A module is just a file. One script is one module.
22+
A module is just a file. One script is one module. As simple as that.
2323

2424
Modules can load each other and use special directives `export` and `import` to interchange functionality, call functions of one module from another one:
2525

@@ -57,8 +57,8 @@ Like this:
5757

5858
The browser automatically fetches and evaluates the imported module (and its imports if needed), and then runs the script.
5959

60-
```warn header="Modules work only via HTTP, not in local files"
61-
If you try to open a web-page locally, via `file://` protocol, you'll find that `import/export` directives don't work. Use a local web-server, such as [static-server](https://www.npmjs.com/package/static-server#getting-started) or use the "live server" capability of your editor, such as VS Code [Live Server Extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) to test them.
60+
```warn header="Modules work only via HTTP(s), not in local files"
61+
If you try to open a web-page locally, via `file://` protocol, you'll find that `import/export` directives don't work. Use a local web-server, such as [static-server](https://www.npmjs.com/package/static-server#getting-started) or use the "live server" capability of your editor, such as VS Code [Live Server Extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) to test modules.
6262
```
6363

6464
## Core module features

0 commit comments

Comments
 (0)