Skip to content

Commit 8bd4fe0

Browse files
authored
Merge pull request #24 from javascript-tutorial/sync-7b761858
Sync with upstream @ 7b76185
2 parents a113a73 + d9a4fa8 commit 8bd4fe0

File tree

181 files changed

+1477
-1056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+1477
-1056
lines changed

1-js/01-getting-started/1-intro/article.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# An Introduction to JavaScript
22

3-
Let's see what's so special about JavaScript, what we can achieve with it, and which other technologies play well with it.
3+
Let's see what's so special about JavaScript, what we can achieve with it, and what other technologies play well with it.
44

55
## What is JavaScript?
66

@@ -110,12 +110,13 @@ Examples of such languages:
110110
- [TypeScript](http://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
111111
- [Flow](http://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
112112
- [Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
113-
- [Brython](https://brython.info/) is a Python transpiler to JavaScript that allow to write application in pure Python without JavaScript.
113+
- [Brython](https://brython.info/) is a Python transpiler to JavaScript that enables the writing of applications in pure Python without JavaScript.
114+
- [Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) is a modern, concise and safe programming language that can target the browser or Node.
114115

115116
There are more. Of course, even if we use one of transpiled languages, we should also know JavaScript to really understand what we're doing.
116117

117118
## Summary
118119

119-
- JavaScript was initially created as a browser-only language, but is now used in many other environments as well.
120-
- Today, JavaScript has a unique position as the most widely-adopted browser language with full integration with HTML/CSS.
120+
- JavaScript was initially created as a browser-only language, but it is now used in many other environments as well.
121+
- Today, JavaScript has a unique position as the most widely-adopted browser language with full integration in HTML/CSS.
121122
- There are many languages that get "transpiled" to JavaScript and provide certain features. It is recommended to take a look at them, at least briefly, after mastering JavaScript.

1-js/01-getting-started/2-manuals-specifications/article.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@ A new specification version is released every year. In-between these releases, t
1313

1414
To read about new bleeding-edge features, including those that are "almost standard" (so-called "stage 3"), see proposals at <https://github.com/tc39/proposals>.
1515

16-
Also, if you're in developing for the browser, then there are other specs covered in the [second part](info:browser-environment) of the tutorial.
16+
Also, if you're developing for the browser, then there are other specifications covered in the [second part](info:browser-environment) of the tutorial.
1717

1818
## Manuals
1919

20-
- **MDN (Mozilla) JavaScript Reference** is a manual with examples and other information. It's great to get in-depth information about individual language functions, methods etc.
20+
- **MDN (Mozilla) JavaScript Reference** is the main manual with examples and other information. It's great to get in-depth information about individual language functions, methods etc.
2121

2222
One can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
2323

24-
Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for `parseInt` function.
25-
26-
27-
- **MSDN** – Microsoft manual with a lot of information, including JavaScript (often referred to as JScript). If one needs something specific to Internet Explorer, better go there: <http://msdn.microsoft.com/>.
28-
29-
Also, we can use an internet search with phrases such as "RegExp MSDN" or "RegExp MSDN jscript".
24+
Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for `parseInt` function.
3025

3126
## Compatibility tables
3227

1-js/01-getting-started/4-devtools/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To see errors and get a lot of other useful information about scripts, "develope
88

99
Most developers lean towards Chrome or Firefox for development because those browsers have the best developer tools. Other browsers also provide developer tools, sometimes with special features, but are usually playing "catch-up" to Chrome or Firefox. So most developers have a "favorite" browser and switch to others if a problem is browser-specific.
1010

11-
Developer tools are potent; they have many features. To start, we'll learn how to open them, look at errors, and run JavaScript commands.
11+
Developer tools are potent, they have many features. To start, we'll learn how to open them, look at errors, and run JavaScript commands.
1212

1313
## Google Chrome
1414

1-js/02-first-steps/01-hello-world/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ So first, let's see how we attach a script to a webpage. For server-side environ
99

1010
## The "script" tag
1111

12-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>` tag.
12+
JavaScript programs can be inserted almost anywhere into an HTML document using the `<script>` tag.
1313

1414
For instance:
1515

1-js/02-first-steps/04-variables/2-declare-variables/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ That's simple:
66
let ourPlanetName = "Earth";
77
```
88

9-
Note, we could use a shorter name `planet`, but it might be not obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong.
9+
Note, we could use a shorter name `planet`, but it might not be obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong.
1010

1111
## The name of the current visitor
1212

1-js/02-first-steps/08-operators/3-primitive-conversions-questions/solution.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ true + false = 1
99
"$" + 4 + 5 = "$45"
1010
"4" - 2 = 2
1111
"4px" - 2 = NaN
12-
7 / 0 = Infinity
1312
" -9 " + 5 = " -9 5" // (3)
1413
" -9 " - 5 = -14 // (4)
1514
null + 1 = 1 // (5)

1-js/02-first-steps/08-operators/3-primitive-conversions-questions/task.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ true + false
1616
"$" + 4 + 5
1717
"4" - 2
1818
"4px" - 2
19-
7 / 0
2019
" -9 " + 5
2120
" -9 " - 5
2221
null + 1

1-js/02-first-steps/08-operators/article.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,21 @@ alert( 8 % 3 ); // 2, a remainder of 8 divided by 3
5656

5757
### Exponentiation **
5858

59-
The exponentiation operator `a ** b` multiplies `a` by itself `b` times.
59+
The exponentiation operator `a ** b` raises `a` to the power of `b`.
60+
61+
In school maths, we write that as a<sup>b</sup>.
6062

6163
For instance:
6264

6365
```js run
64-
alert( 2 ** 2 ); // 4 (2 multiplied by itself 2 times)
65-
alert( 2 ** 3 ); // 8 (2 * 2 * 2, 3 times)
66-
alert( 2 ** 4 ); // 16 (2 * 2 * 2 * 2, 4 times)
66+
alert( 2 ** 2 ); // 2² = 4
67+
alert( 2 ** 3 ); // 2³ = 8
68+
alert( 2 ** 4 ); // 2⁴ = 16
6769
```
6870

69-
Mathematically, the exponentiation is defined for non-integer numbers as well. For example, a square root is an exponentiation by `1/2`:
71+
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
72+
73+
For example, a square root is an exponentiation by ½:
7074

7175
```js run
7276
alert( 4 ** (1/2) ); // 2 (power of 1/2 is the same as a square root)
@@ -104,7 +108,12 @@ Here's a more complex example:
104108
alert(2 + 2 + '1' ); // "41" and not "221"
105109
```
106110
107-
Here, operators work one after another. The first `+` sums two numbers, so it returns `4`, then the next `+` adds the string `1` to it, so it's like `4 + '1' = 41`.
111+
Here, operators work one after another. The first `+` sums two numbers, so it returns `4`, then the next `+` adds the string `1` to it, so it's like `4 + '1' = '41'`.
112+
113+
```js run
114+
alert('1' + 2 + 2); // "122" and not "14"
115+
```
116+
Here, the first operand is a string, the compiler treats the other two operands as strings too. The `2` gets concatenated to `'1'`, so it's like `'1' + 2 = "12"` and `"12" + 2 = "122"`.
108117
109118
The binary `+` is the only operator that supports strings in such a way. Other arithmetic operators work only with numbers and always convert their operands to numbers.
110119
@@ -214,7 +223,7 @@ alert( x ); // 5
214223
215224
The fact of `=` being an operator, not a "magical" language construct has an interesting implication.
216225
217-
Most operators in JavaScript return a value. That's obvious for `+` and `-`, but also true for `=`.
226+
All operators in JavaScript return a value. That's obvious for `+` and `-`, but also true for `=`.
218227

219228
The call `x = value` writes the `value` into `x` *and then returns it*.
220229

1-js/02-first-steps/10-ifelse/2-check-standard/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ importance: 2
66

77
Using the `if..else` construct, write the code which asks: 'What is the "official" name of JavaScript?'
88

9-
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "Didn't know? ECMAScript!"
9+
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "You don't know? ECMAScript!"
1010

1111
![](ifelse_task2.svg)
1212

1-js/02-first-steps/10-ifelse/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if (cond) {
6868

6969
## The "else" clause
7070

71-
The `if` statement may contain an optional "else" block. It executes when the condition is false.
71+
The `if` statement may contain an optional "else" block. It executes when the condition is falsy.
7272

7373
For example:
7474
```js run

0 commit comments

Comments
 (0)