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: 1-js/01-getting-started/1-intro/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The engine applies optimizations on every stage of the process. It even watches
45
45
46
46
The modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.
47
47
48
-
The capabilities greatly depend on the environment that runs JavaScript. For instance, [Node.JS](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests etc.
48
+
The capabilities greatly depend on the environment that runs JavaScript. For instance, [Node.JS](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
49
49
50
50
In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.
Copy file name to clipboardExpand all lines: 1-js/01-getting-started/2-code-editors/article.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,14 +16,12 @@ If you haven't considered selecting an IDE yet, look at the following variants:
16
16
-[Visual Studio Code](https://code.visualstudio.com/) (free).
17
17
-[Netbeans](http://netbeans.org/) (paid).
18
18
19
-
All of the IDEs except cross-platform.
19
+
All of the IDEs are cross-platform.
20
20
21
-
For Windows, there's also a "Visual Studio" editor, don't mess it with "Visual Studio Code". "Visual Studio" is a paid and actually very powerful Windows-only editor, well-suited for .NET platform. A free version of it is called ([Visual Studio Community](https://www.visualstudio.com/vs/community/)).
21
+
For Windows, there's also a "Visual Studio" editor, don't confuse it with "Visual Studio Code". "Visual Studio" is a paid and actually very powerful Windows-only editor, well-suited for .NET platform. A free version of it is called ([Visual Studio Community](https://www.visualstudio.com/vs/community/).
22
22
23
23
Many IDEs are paid, but have a trial period. Their cost is usually negligible compared to a qualified developer's salary, so just choose the best one for you.
24
24
25
-
26
-
27
25
## Lightweight editors
28
26
29
27
"Lightweight editors" are not as powerful as IDEs, but they're fast, elegant and simple.
@@ -53,7 +51,7 @@ I'm using:
53
51
54
52
## Let's not argue
55
53
56
-
The editors in the lists above are those that either I or my friends who I consider good developers have been using for a long time and are happy with.
54
+
The editors in the lists above are those that either I or my friends whom I consider good developers have been using for a long time and are happy with.
57
55
58
56
There are other great editors in our big world. Please choose the one you like the most.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/01-hello-world/article.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,10 +47,10 @@ The `<script>` tag has a few attributes that are rarely used nowadays, but we ca
47
47
48
48
The `type` attribute: <code><script <u>type</u>=...></code>
49
49
50
-
: The old standard HTML4 required a script to have a type. Usually it was `type="text/javascript"`. It's not required any more. Also, the modern standard totally changed the meaning of this attribute. Now it can be used for Javascript modules. But that's an advanced topic, but we'll talk about modules later in another part of the tutorial.
50
+
: The old standard HTML4 required a script to have a type. Usually it was `type="text/javascript"`. It's not required any more. Also, the modern standard totally changed the meaning of this attribute. Now it can be used for Javascript modules. But that's an advanced topic; we'll talk about modules later in another part of the tutorial.
51
51
52
52
The `language` attribute: <code><script <u>language</u>=...></code>
53
-
: This attribute was meant to show the language of the script. As of now, this attribute makes no sense, the language is JavaScript by default. No need to use it.
53
+
: This attribute was meant to show the language of the script. This attribute no longer makes sense, because JavaScript is the default language. No need to use it.
54
54
55
55
Comments before and after scripts.
56
56
: In really ancient books and guides, one may find comments inside `<script>`, like this:
@@ -61,7 +61,7 @@ Comments before and after scripts.
61
61
//--></script>
62
62
```
63
63
64
-
This trick isn't used in modern JavaScript. These comments were used to hide the JavaScript code from old browsers that didn't know about a `<script>` tag. Since browsers born in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
64
+
This trick isn't used in modern JavaScript. These comments were used to hide the JavaScript code from old browsers that didn't know about a `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
65
65
66
66
67
67
## External scripts
@@ -78,7 +78,7 @@ Here `/path/to/script.js` is an absolute path to the file with the script (from
78
78
79
79
It is also possible to provide a path relative to the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/02-structure/article.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The first thing to study is the building blocks of the code.
6
6
7
7
Statements are syntax constructs and commands that perform actions.
8
8
9
-
We've already seen a statement `alert('Hello, world!')`, which shows the message.
9
+
We've already seen a statement `alert('Hello, world!')`, which shows the message "Hello world!".
10
10
11
11
We can have as many statements in the code as we want. Another statement can be separated with a semicolon.
12
12
@@ -46,7 +46,7 @@ alert(3 +
46
46
+2);
47
47
```
48
48
49
-
The code outputs `6`, because JavaScript does not insert semicolons here. It is intuitively obvious that if the line ends with a plus `"+"`, then it is an "incomplete expression", no semicolon required. And in this case that works as intended.
49
+
The code outputs `6` because JavaScript does not insert semicolons here. It is intuitively obvious that if the line ends with a plus `"+"`, then it is an "incomplete expression", so the semicolon is not required. And in this case that works as intended.
50
50
51
51
**But there are situations where JavaScript "fails" to assume a semicolon where it is really needed.**
52
52
@@ -98,7 +98,7 @@ It's recommended to put semicolons between statements even if they are separated
98
98
99
99
As time goes on, the program becomes more and more complex. It becomes necessary to add *comments* which describe what happens and why.
100
100
101
-
Comments can be put into any place of the script. They don't affect the execution, because the engine simply ignores them.
101
+
Comments can be put into any place of the script. They don't affect the execution because the engine simply ignores them.
102
102
103
103
**One-line comments start with two forward slash characters `//`.**
104
104
@@ -156,4 +156,4 @@ Please, don't hesitate to comment your code.
156
156
157
157
Comments increase the overall code footprint, but that's not a problem at all. There are many tools which minify the code before publishing to the production server. They remove comments, so they don't appear in the working scripts. Therefore comments do not have any negative effects on production at all.
158
158
159
-
Further in the tutorial, there will be a chapter <info:coding-style> that also explains how to write better comments.
159
+
Further in the tutorial there will be a chapter <info:coding-style> that also explains how to write better comments.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/14-function-basics/article.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
@@ -263,7 +263,7 @@ function checkAge(age) {
263
263
*/!*
264
264
} else {
265
265
*!*
266
-
returnconfirm('Got a permission from the parents?');
266
+
returnconfirm('Do you have permission from your parents?');
267
267
*/!*
268
268
}
269
269
}
@@ -334,7 +334,7 @@ So, it effectively becomes an empty return. We should put the value on the same
334
334
335
335
## Naming a function [#function-naming]
336
336
337
-
Functions are actions. So their name is usually a verb. It should briefly, but as accurately as possible describe what the function does. So that a person who reads the code gets the right clue.
337
+
Functions are actions. So their name is usually a verb. It should briefly, but as accurately as possible, describe what the function does, so that someone reading the code gets an indication of what the function does.
338
338
339
339
It is a widespread practice to start a function with a verbal prefix which vaguely describes the action. There must be an agreement within the team on the meaning of the prefixes.
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/15-function-expressions-arrows/article.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,8 +78,8 @@ let func = sayHi;
78
78
Everything would work the same. Even more obvious what's going on, right?
79
79
80
80
81
-
````smart header="Why there's a semicolon at the end?"
82
-
There might be a question, why does Function Expression have a semicolon `;` at the end, and Function Declaration does not:
81
+
````smart header="Why is there a semicolon at the end?"
82
+
You might wonder, why does Function Expression have a semicolon `;` at the end, but Function Declaration does not:
83
83
84
84
```js
85
85
function sayHi() {
@@ -198,7 +198,7 @@ The more subtle difference is *when* a function is created by the JavaScript eng
198
198
199
199
**A Function Expression is created when the execution reaches it and is usable from then on.**
200
200
201
-
Once the execution flow passes to the right side of the assignment `let sum = function…` -- here we go, the function is created and can be used (assigned, calledetc) from now on.
201
+
Once the execution flow passes to the right side of the assignment `let sum = function…` -- here we go, the function is created and can be used (assigned, called,etc. ) from now on.
202
202
203
203
Function Declarations are different.
204
204
@@ -350,7 +350,7 @@ welcome(); // ok now
350
350
```
351
351
352
352
353
-
```smart header="When to choose Function Declaration versus Function Expression?"
353
+
```smart header="When should you choose Function Declaration versus Function Expression?"
354
354
As a rule of thumb, when we need to declare a function, the first to consider is Function Declaration syntax, the one we used before. It gives more freedom in how to organize our code, because we can call such functions before they are declared.
355
355
356
356
It's also a little bit easier to look up `function f(…) {…}` in the code than `let f = function(…) {…}`. Function Declarations are more "eye-catching".
@@ -375,7 +375,7 @@ In other words, it's roughly the same as:
0 commit comments