Skip to content

Commit f4ec378

Browse files
committedMay 11, 2019
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-29a3c58d
2 parents 737460e + 29a3c58 commit f4ec378

File tree

60 files changed

+263
-274
lines changed

Some content is hidden

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

60 files changed

+263
-274
lines changed
 

Diff for: ‎1-js/01-getting-started/1-intro/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Let's see what's so special about JavaScript, what we can achieve with it, and w
66

77
*JavaScript* was initially created to *"make web pages alive"*.
88

9-
The programs in this language are called *scripts*. They can be written right in a web page's HTML and executed automatically as the page loads.
9+
The programs in this language are called *scripts*. They can be written right in a web page's HTML and run automatically as the page loads.
1010

1111
Scripts are provided and executed as plain text. They don't need special preparation or compilation to run.
1212

@@ -70,7 +70,7 @@ Examples of such restrictions include:
7070
There are ways to interact with camera/microphone and other devices, but they require a user's explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the [NSA](https://en.wikipedia.org/wiki/National_Security_Agency).
7171
- Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other if they come from different sites (from a different domain, protocol or port).
7272

73-
This is called the "Same Origin Policy". To work around that, *both pages* must contain a special JavaScript code that handles data exchange.
73+
This is called the "Same Origin Policy". To work around that, *both pages* must agree for data exchange and contain a special JavaScript code that handles it. We'll cover that in the tutorial.
7474

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.

Diff for: ‎1-js/02-first-steps/04-variables/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ alert(message); // Hello world!
136136
```
137137
138138
```smart header="Functional languages"
139-
It's interesting to note that [functional](https://en.wikipedia.org/wiki/Functional_programming) programming languages, like [Scala](http://www.scala-lang.org/) or [Erlang](http://www.erlang.org/), forbid changing variable values.
139+
It's interesting to note that there exist [functional](https://en.wikipedia.org/wiki/Functional_programming) programming languages, like [Scala](http://www.scala-lang.org/) or [Erlang](http://www.erlang.org/) that forbid changing variable values.
140140
141141
In such languages, once the value is stored "in the box", it's there forever. If we need to store something else, the language forces us to create a new box (declare a new variable). We can't reuse the old one.
142142
@@ -182,7 +182,7 @@ let my-name; // hyphens '-' aren't allowed in the name
182182
Variables named `apple` and `AppLE` are two different variables.
183183
```
184184
185-
````smart header="Non-English letters are allowed, but not recommended"
185+
````smart header="Non-Latin letters are allowed, but not recommended"
186186
It is possible to use any language, including cyrillic letters or even hieroglyphs, like this:
187187
188188
```js
@@ -254,7 +254,7 @@ There is a widespread practice to use constants as aliases for difficult-to-reme
254254
255255
Such constants are named using capital letters and underscores.
256256
257-
Like this:
257+
For instance, let's make constants for colors in so-called "web" (hexadecimal) format:
258258
259259
```js run
260260
const COLOR_RED = "#F00";
@@ -290,7 +290,7 @@ In other words, capital-named constants are only used as aliases for "hard-coded
290290
291291
Talking about variables, there's one more extremely important thing.
292292
293-
Please name your variables sensibly. Take time to think about this.
293+
A variable name should have a clean, obvious meaning, describe the data that it stores.
294294
295295
Variable naming is one of the most important and complex skills in programming. A quick glance at variable names can reveal which code was written by a beginner versus an experienced developer.
296296

0 commit comments

Comments
 (0)