Skip to content

Commit ddece58

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-34e9cdca
2 parents aa6a113 + 34e9cdc commit ddece58

812 files changed

Lines changed: 12595 additions & 543 deletions

File tree

Some content is hidden

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

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Examples of such restrictions include:
7575
This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com` and steal information from there.
7676
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation.
7777

78-
![](limitations.png)
78+
![](limitations.svg)
7979

8080
Such limits do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow plugin/extensions which may ask for extended permissions.
8181

@@ -92,8 +92,7 @@ JavaScript is the only browser technology that combines these three things.
9292

9393
That's what makes JavaScript unique. That's why it's the most widespread tool for creating browser interfaces.
9494

95-
While planning to learn a new technology, it's beneficial to check its perspectives. So let's move on to the modern trends affecting it, including new languages and browser abilities.
96-
95+
That said, JavaScript also allows to create servers, mobile applications, etc.
9796

9897
## Languages "over" JavaScript
9998

-34.8 KB
Binary file not shown.

1-js/01-getting-started/1-intro/limitations.svg

Lines changed: 92 additions & 0 deletions
Loading
-85.9 KB
Binary file not shown.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ Open Preferences and go to the "Advanced" pane. There's a checkbox at the bottom
5050

5151
Now `key:Cmd+Opt+C` can toggle the console. Also, note that the new top menu item named "Develop" has appeared. It has many commands and options.
5252

53-
## Multi-line input
54-
53+
```smart header="Multi-line input"
5554
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
5655
57-
To insert multiple lines, press `key:Shift+Enter`.
56+
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
57+
```
5858

5959
## Summary
6060

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Hello, world!
22

3-
This part of the tutorial is about core JavaScript, the language itself. Later on, you'll learn about Node.js and other platforms that use it.
3+
This part of the tutorial is about core JavaScript, the language itself.
44

55
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial.
66

@@ -46,7 +46,7 @@ The `<script>` tag contains JavaScript code which is automatically executed when
4646
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
4747

4848
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
49-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard, HTML5, 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 in another part of the tutorial.
49+
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML 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 in another part of the tutorial.
5050

5151
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
5252
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
@@ -73,9 +73,7 @@ Script files are attached to HTML with the `src` attribute:
7373
<script src="/path/to/script.js"></script>
7474
```
7575

76-
Here, `/path/to/script.js` is an absolute path to the script file (from the site root).
77-
78-
You can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
76+
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
7977

8078
We can give a full URL as well. For instance:
8179

-43.6 KB
Binary file not shown.
-84 KB
Binary file not shown.

1-js/02-first-steps/03-strict-mode/article.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ For a long time, JavaScript evolved without compatibility issues. New features w
44

55
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-
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"`.
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 such modifications are off by default. You need to explicitly enable them with a special directive: `"use strict"`.
88

99
## "use strict"
1010

@@ -19,9 +19,7 @@ For example:
1919
...
2020
```
2121

22-
We will learn functions (a way to group commands) soon.
23-
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.
22+
We will learn functions (a way to group commands) soon. Looking ahead, let's 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.
2523

2624

2725
````warn header="Ensure that \"use strict\" is at the top"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
First, the variable for the name of our planet.
1+
## The variable for our planet
22

33
That's simple:
44

@@ -8,7 +8,7 @@ let ourPlanetName = "Earth";
88

99
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.
1010

11-
Second, the name of the current visitor:
11+
## The name of the current visitor
1212

1313
```js
1414
let currentUserName = "John";

0 commit comments

Comments
 (0)