Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
d7a609a
Update article.md
hzjjg Jul 19, 2019
f50547d
Updated article.md
AdarshNaidu Jul 21, 2019
8dce063
Updated article.md
AdarshNaidu Jul 21, 2019
1ad465e
Fix set() calls in WeakMap and WeakSet article
Sarratas Jul 21, 2019
8319c71
minor
iliakan Jul 22, 2019
2d748b9
Fix English Grammar
Vivek-raj Jul 22, 2019
8e8f165
Update article.md
tonchique Jul 23, 2019
bacf5df
Minor correction in the answer
AdarshNaidu Jul 23, 2019
ed25d47
minor
iliakan Jul 23, 2019
9a4fe33
minor fixes
rezyx Jul 23, 2019
f4c6c04
Merge pull request #1180 from rezyx/07-microtask-queue-fixes
iliakan Jul 23, 2019
9bbabfa
Merge pull request #1177 from tonchique/patch-12
iliakan Jul 23, 2019
d3ccd26
Merge pull request #1176 from Vivek-raj/patch-1
iliakan Jul 23, 2019
33fe91b
minor
iliakan Jul 23, 2019
e537441
Merge pull request #1174 from Sarratas/patch-1
iliakan Jul 23, 2019
1a7e5c2
Merge pull request #1172 from AdarshNaidu/master
iliakan Jul 23, 2019
6831c5e
Merge pull request #1166 from hzjjg/patch-1
iliakan Jul 23, 2019
66879ad
Correction to "Format the relative date" task
Sarratas Jul 23, 2019
0ade414
Merge pull request #1181 from Sarratas/patch-2
iliakan Jul 24, 2019
03560a7
fix
iliakan Jul 24, 2019
5e8edaf
regexp task
iliakan Jul 24, 2019
876674f
minor
iliakan Jul 24, 2019
a0853ed
fixes
iliakan Jul 25, 2019
bd9eb92
fixes
iliakan Jul 25, 2019
c4a6c4f
minor
iliakan Jul 25, 2019
138237e
fixes
iliakan Jul 26, 2019
604c818
Update article.md
kolosovsky Jul 26, 2019
6899750
Merge pull request #1184 from kolosovsky/patch-3
iliakan Jul 26, 2019
f6ff773
minor fixes
iliakan Jul 26, 2019
339c0b6
Fix typo
vavlza Jul 26, 2019
dd16ce4
Merge pull request #1185 from va-z/patch-1
iliakan Jul 26, 2019
a6284de
minor
iliakan Jul 26, 2019
afe6d11
Minor typo error
sridharkritha Jul 27, 2019
c59069c
pre-move sketch to svg
iliakan Jul 27, 2019
63dc4cd
images to svg
iliakan Jul 27, 2019
2277f2f
images
iliakan Jul 27, 2019
79433bd
image
iliakan Jul 27, 2019
fa50e7f
Merge pull request #1186 from sridharkritha/patch-1
iliakan Jul 27, 2019
d560bce
minor
iliakan Jul 27, 2019
a31e881
svg
iliakan Jul 27, 2019
3ba28aa
images to svg
iliakan Jul 28, 2019
34e9cdc
minor
iliakan Jul 28, 2019
e4b22f4
minor
iliakan Jul 29, 2019
def3430
minor
iliakan Jul 29, 2019
698cd61
move to svg
iliakan Jul 29, 2019
db9d685
cleanup
iliakan Jul 29, 2019
f22874e
fix
iliakan Jul 29, 2019
19c782f
fix
iliakan Jul 29, 2019
1948ce8
minor
iliakan Jul 29, 2019
3e76408
clean
iliakan Jul 29, 2019
f72405a
minor
iliakan Jul 29, 2019
4f69506
Fix a small typo
amirhoseinsalimi Jul 29, 2019
9110df0
minor
iliakan Jul 29, 2019
7cc7dbb
up
iliakan Jul 29, 2019
1b8dd82
fix typo in 5-network/11-websocket/article.md
lycheeEng Jul 30, 2019
728786d
minor
iliakan Jul 30, 2019
4fed786
minor
iliakan Jul 30, 2019
b7bfe09
minor
iliakan Jul 30, 2019
fd9c928
minor
iliakan Jul 30, 2019
a560e65
minor
iliakan Jul 30, 2019
634c71d
minor
iliakan Jul 30, 2019
db7a38b
minor
iliakan Jul 30, 2019
69df30c
minor
iliakan Jul 30, 2019
ef32965
minor
iliakan Jul 30, 2019
84fbfea
Update article.md
iliakan Jul 30, 2019
5deaa8a
Update article.md
Violet-Bora-Lee Jul 30, 2019
a8f90e8
minor
iliakan Jul 30, 2019
bbf98b2
fixes
iliakan Jul 30, 2019
5ecfdf6
fixes
iliakan Jul 30, 2019
710d566
Merge pull request #1195 from Violet-Bora-Lee/patch-10
iliakan Jul 31, 2019
0ebb448
Merge pull request #1189 from lycheeEng/patch-1
iliakan Jul 31, 2019
ff09b8c
Merge pull request #1188 from amirhoseinsalimi/patch-1
iliakan Jul 31, 2019
6782931
minor
iliakan Jul 31, 2019
85e67eb
fixes
iliakan Jul 31, 2019
3ffe663
Fix typo: referrerd -> referred
alexmuller Jul 31, 2019
19cd4ab
up
iliakan Jul 31, 2019
4e9f302
minor
iliakan Jul 31, 2019
b6adf0b
up
iliakan Jul 31, 2019
715d5e7
up
iliakan Jul 31, 2019
02d1b76
up
iliakan Jul 31, 2019
446154f
up
iliakan Jul 31, 2019
9020c49
Fix Selection getting demo
theFigurin Jul 30, 2019
2753565
minor
iliakan Aug 1, 2019
ea9d389
Merge pull request #1198 from theFigurin/fix-selection-getting-demo
iliakan Aug 1, 2019
be6e2cd
Merge pull request #1196 from alexmuller/fix-typo-referred-jscript
iliakan Aug 1, 2019
475f66a
Object reference was incorrect.
shekhardtu Aug 1, 2019
d907500
Merge pull request #1200 from harishekhar/patch-1
iliakan Aug 1, 2019
e6e5620
minor
iliakan Aug 1, 2019
b6b06f6
minor
iliakan Aug 1, 2019
63acd3d
fix phrasing by deleting superfluous word
dagolinuxoid Aug 2, 2019
9b55869
insert the 'if' word
dagolinuxoid Aug 2, 2019
4524596
Merge pull request #1202 from dagolinuxoid/patch-3
iliakan Aug 2, 2019
51cf334
Merge pull request #1201 from dagolinuxoid/patch-2
iliakan Aug 2, 2019
515e5fd
minor
iliakan Aug 2, 2019
d606fb7
minor
iliakan Aug 2, 2019
e52705e
fixes
iliakan Aug 2, 2019
f88a41b
fixes
iliakan Aug 2, 2019
0b23bfb
up
iliakan Aug 2, 2019
74fb2ec
Update article.md
kjhughes Aug 2, 2019
4a41b16
Merge pull request #1205 from kjhughes/patch-1
iliakan Aug 2, 2019
414f962
Update article.md
kjhughes Aug 2, 2019
799d373
Merge pull request #1206 from kjhughes/patch-2
iliakan Aug 2, 2019
b8c2b9f
Update article.md
kjhughes Aug 2, 2019
25a77d3
currying
iliakan Aug 2, 2019
0757d51
fixes
iliakan Aug 2, 2019
a894b9e
minor
iliakan Aug 2, 2019
38e1937
update article.md
upbeatcode Aug 3, 2019
aa65012
fixes
iliakan Aug 3, 2019
31710a3
minor
iliakan Aug 3, 2019
f42fd2a
minor
iliakan Aug 3, 2019
0db121d
Updated article.md
AdarshNaidu Aug 3, 2019
af3a544
Merge pull request #1210 from AdarshNaidu/change-1
iliakan Aug 3, 2019
886a62d
Merge pull request #1208 from upbeatcode/master
iliakan Aug 3, 2019
ccfd721
Merge pull request #1207 from kjhughes/patch-3
iliakan Aug 3, 2019
e50b6cc
minor
iliakan Aug 3, 2019
50094f7
minor
iliakan Aug 3, 2019
e50185a
minor
iliakan Aug 3, 2019
6324325
minor
iliakan Aug 3, 2019
61bc426
typo
iliakan Aug 4, 2019
800d47c
minor
iliakan Aug 4, 2019
f968724
minor
iliakan Aug 4, 2019
6d1fa5d
fixes
iliakan Aug 4, 2019
d63c27b
minor
iliakan Aug 4, 2019
902a7e7
minor
iliakan Aug 4, 2019
fb38a13
minor
iliakan Aug 4, 2019
0fb0d37
delete ru sentence from en article
dagolinuxoid Aug 5, 2019
335131c
Merge pull request #1214 from dagolinuxoid/patch-4
iliakan Aug 5, 2019
083ba1c
paste negation
dagolinuxoid Aug 5, 2019
d1d8c96
Merge pull request #1215 from dagolinuxoid/patch-5
iliakan Aug 5, 2019
80dd2cb
minor
iliakan Aug 5, 2019
07975a7
minor
iliakan Aug 5, 2019
2ffe7c4
minor
iliakan Aug 5, 2019
bdf28d6
minor
iliakan Aug 5, 2019
704cad8
Update article.md
Violet-Bora-Lee Aug 5, 2019
dc0a638
minor
iliakan Aug 5, 2019
1863944
Merge pull request #1217 from Violet-Bora-Lee/patch-15
iliakan Aug 5, 2019
fc2bb4d
minor
iliakan Aug 5, 2019
7f8b633
minor
iliakan Aug 5, 2019
e0f6027
minor
iliakan Aug 5, 2019
a6a0031
minor
iliakan Aug 5, 2019
500b7c9
minor
iliakan Aug 5, 2019
3f8fb3d
minor
iliakan Aug 5, 2019
f72af57
minor
iliakan Aug 5, 2019
cc25e23
minor
iliakan Aug 5, 2019
703a4f4
minor
iliakan Aug 5, 2019
fc66b43
minor
iliakan Aug 5, 2019
b7a0591
minor
iliakan Aug 6, 2019
68fdeee
minor
iliakan Aug 6, 2019
84ff065
minor
iliakan Aug 6, 2019
78fbf95
minor
iliakan Aug 6, 2019
e806673
minor
iliakan Aug 7, 2019
8bd8e90
minor
iliakan Aug 7, 2019
c443777
minor
iliakan Aug 7, 2019
a7cecc1
Update article.md
Violet-Bora-Lee Aug 7, 2019
bcc7cb5
minor fix
Violet-Bora-Lee Aug 7, 2019
72edbfb
minor
iliakan Aug 7, 2019
fc9b50f
Merge pull request #1223 from Violet-Bora-Lee/patch-17
iliakan Aug 7, 2019
dc86dce
Merge pull request #1222 from Violet-Bora-Lee/patch-16
iliakan Aug 7, 2019
ab20ddd
minor
iliakan Aug 7, 2019
9f98090
minor
iliakan Aug 8, 2019
3d631ec
Update Safari screenshots
jinpae Aug 8, 2019
c3783a7
minor
iliakan Aug 8, 2019
816d193
Merge pull request #1225 from jinpae/safari-screenshots
iliakan Aug 8, 2019
7e32cf2
minor
iliakan Aug 8, 2019
8a3e1fd
minor
iliakan Aug 8, 2019
7ba2f4f
minor
iliakan Aug 8, 2019
009528a
Russian word typo in English translation
alexgarbarev Aug 9, 2019
39cc399
Merge pull request #1229 from alexgarbarev/patch-1
iliakan Aug 9, 2019
8b1acfe
Update article.md
Violet-Bora-Lee Aug 9, 2019
260c187
Update article.md
Violet-Bora-Lee Aug 9, 2019
919ddb8
minor
iliakan Aug 9, 2019
5173faa
Merge pull request #1230 from Violet-Bora-Lee/patch-19
iliakan Aug 9, 2019
a66f514
minor
iliakan Aug 9, 2019
e828850
closes #1233
iliakan Aug 9, 2019
207fbe8
minor
iliakan Aug 9, 2019
88cc735
minor
iliakan Aug 9, 2019
5b9f6b0
minor
iliakan Aug 10, 2019
b2bbd1c
minor
iliakan Aug 10, 2019
69acca8
minor
iliakan Aug 10, 2019
fd0f108
minor
iliakan Aug 10, 2019
7af63ff
minor
iliakan Aug 10, 2019
0e08048
minor
iliakan Aug 10, 2019
4ac9bec
minor
iliakan Aug 10, 2019
2fbba39
minor
iliakan Aug 10, 2019
1310171
minor
iliakan Aug 10, 2019
4d44df6
Embed font to SVG
iliakan Aug 11, 2019
9bfc8cf
minor
iliakan Aug 11, 2019
e75e0f3
minor
iliakan Aug 11, 2019
74e473a
refactor
iliakan Aug 11, 2019
5cb9760
minor
iliakan Aug 11, 2019
b9e6e75
minor
iliakan Aug 12, 2019
763aba5
fixes
iliakan Aug 13, 2019
4856c06
Replace "Midget" with "Widget" in example words
jedpimentel Aug 13, 2019
a2daa01
minor
iliakan Aug 13, 2019
4bc42e1
minor
iliakan Aug 13, 2019
7c9e531
minor
iliakan Aug 13, 2019
6d7b926
Merge pull request #1237 from jedpimentel/patch-1
iliakan Aug 14, 2019
b753823
minor
iliakan Aug 14, 2019
39309e6
minor
iliakan Aug 14, 2019
0d2e359
minor
iliakan Aug 14, 2019
1fa91ba
minor
iliakan Aug 14, 2019
48e8f65
minor
iliakan Aug 14, 2019
0a4f321
minor
iliakan Aug 14, 2019
4635abd
minor
iliakan Aug 14, 2019
aa4273f
minor
iliakan Aug 14, 2019
99cbc65
minor
iliakan Aug 14, 2019
7fd3eb1
minor
iliakan Aug 15, 2019
1144f47
Update article.md
Violet-Bora-Lee Aug 17, 2019
d94b292
fixes
iliakan Aug 17, 2019
dbbb620
fixes
iliakan Aug 17, 2019
4b9a771
Merge pull request #1240 from Violet-Bora-Lee/patch-23
iliakan Aug 17, 2019
420ab39
minor
iliakan Aug 17, 2019
92d6dc5
minor
iliakan Aug 17, 2019
28a514a
minor
iliakan Aug 17, 2019
cdf6156
minor
iliakan Aug 17, 2019
28cc5c8
minor
iliakan Aug 18, 2019
5d1037c
minor
iliakan Aug 18, 2019
9bfd54a
minor
iliakan Aug 18, 2019
3d4fa7c
minor
iliakan Aug 18, 2019
852ee18
minor
iliakan Aug 18, 2019
7baa50e
merging all conflicts
iliakan Aug 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto eol=lf
*.svg binary
4 changes: 4 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ JavaScript este singura tehnologie browser care combină aceste 3 lucruri.

Asta e ceea ce face JavaScript unic. De aceea este cea mai răspândită unealtă pentru crearea de interfețe pentru browser.

<<<<<<< HEAD
Pe parcursul planificării învățării unei noi tehnologii este benefic să verifici perspectivele acesteia. Așa că să trecem la trendurile moderne care includ noi limbaje și abilități ale browser-ului.

=======
That said, JavaScript also allows to create servers, mobile applications, etc.
>>>>>>> 852ee189170d9022f67ab6d387aeae76810b5923

## Limbaje "peste" JavaScript

Expand Down
4 changes: 4 additions & 0 deletions 1-js/01-getting-started/2-manuals-specifications/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ De asemenea, dacă programezi pentru browser, atunci sunt și alte specificații
Deși, adeseori cel mai bine este să cauți pe internet. Doar folosește "MDN [term]" în query, e.g. <https://google.com/search?q=MDN+parseInt> pentru a căuta funcția `parseInt`.


<<<<<<< HEAD
- **MSDN** – manual de la Microsoft cu o multitudine de informații, inclusiv JavaScript (adeseori menționat ca JScript). Dacă cineva are nevoie de ceva specific pentru Internet Explorer, cel mai bine este să vadă: <http://msdn.microsoft.com/>.

De asemenea, putem căuta pe internet fraze de genul "RegExp MSDN" or "RegExp MSDN jscript".
=======
- **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/>.
>>>>>>> 852ee189170d9022f67ab6d387aeae76810b5923

## Tabele de compatibilitate

Expand Down
8 changes: 8 additions & 0 deletions 1-js/01-getting-started/4-devtools/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ Deschideți preferințele (Preferences) și mergeți în secțiunea de setări a

Acum, cu tastele `key:Cmd+Opt+C` puteți afișa sau ascunde consola. De asemenea, în meniul principal a apărut opțiunea "Develop". Are multe comenzi și opțiuni.

<<<<<<< HEAD
## Date de intrare pe mai multe linii

În mod obișnuit, când introducem o linie de cod în consolă și apoi apăsăm `key:Enter`, codul se execută.

Pentru a introduce mai multe linii, apăsați `key:Shift+Enter`.
=======
```smart header="Multi-line input"
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.

To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
```
>>>>>>> 852ee189170d9022f67ab6d387aeae76810b5923

## Concluzii

Expand Down
Binary file modified 1-js/01-getting-started/4-devtools/safari.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 1-js/01-getting-started/4-devtools/safari@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions 1-js/02-first-steps/01-hello-world/article.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hello, world!

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.
This part of the tutorial is about core JavaScript, the language itself.

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.

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

The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
: 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.
: 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.

The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
: 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.
Expand All @@ -73,9 +73,7 @@ Script files are attached to HTML with the `src` attribute:
<script src="/path/to/script.js"></script>
```

Here, `/path/to/script.js` is an absolute path to the script file (from the site root).

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

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

Expand Down
6 changes: 2 additions & 4 deletions 1-js/02-first-steps/03-strict-mode/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ For a long time, JavaScript evolved without compatibility issues. New features w

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.

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"`.
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"`.

## "use strict"

Expand All @@ -19,9 +19,7 @@ For example:
...
```

We will learn functions (a way to group commands) soon.

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.
We will learn functions (a way to group commands) soon. Looking ahead, let's note that `"use strict"` can be put at the beginning of the function body instead of the whole script. Doing that enables strict mode in that function only. But usually, people use it for the whole script.


````warn header="Ensure that \"use strict\" is at the top"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
First, the variable for the name of our planet.
## The variable for our planet

That's simple:

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

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.

Second, the name of the current visitor:
## The name of the current visitor

```js
let currentUserName = "John";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ We generally use upper case for constants that are "hard-coded". Or, in other wo

In this code, `birthday` is exactly like that. So we could use the upper case for it.

In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`, it is calculated, so we should keep the lower case for it.
In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`: it is calculated, so we should keep the lower case for it.
2 changes: 1 addition & 1 deletion 1-js/02-first-steps/04-variables/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ Modern JavaScript minifiers and browsers optimize code well enough, so it won't

We can declare variables to store data by using the `var`, `let`, or `const` keywords.

- `let` -- is a modern variable declaration. The code must be in strict mode to use `let` in Chrome (V8).
- `let` -- is a modern variable declaration.
- `var` -- is an old-school variable declaration. Normally we don't use it at all, but we'll cover subtle differences from `let` in the chapter <info:var>, just in case you need them.
- `const` -- is like `let`, but the value of the variable can't be changed.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/02-first-steps/05-types/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The `object` type is special.

All other types are called "primitive" because their values can contain only a single thing (be it a string or a number or whatever). In contrast, objects are used to store collections of data and more complex entities. We'll deal with them later in the chapter <info:object> after we learn more about primitives.

The `symbol` type is used to create unique identifiers for objects. We have to mention it here for completeness, but it's better to study this type after objects.
The `symbol` type is used to create unique identifiers for objects. We mention it here for completeness, but we'll study it after objects.

## The typeof operator [#type-typeof]

Expand Down
8 changes: 3 additions & 5 deletions 1-js/02-first-steps/07-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ alert( +"" ); // 0

It actually does the same thing as `Number(...)`, but is shorter.

The need to convert strings to numbers arises very often. For example, if we are getting values from HTML form fields, they are usually strings.

What if we want to sum them?
The need to convert strings to numbers arises very often. For example, if we are getting values from HTML form fields, they are usually strings. What if we want to sum them?

The binary plus would add them as strings:

Expand Down Expand Up @@ -253,14 +251,14 @@ So, there are special operators for it:

```js run no-beautify
let counter = 2;
counter++; // works the same as counter = counter + 1, but is shorter
counter++; // works the same as counter = counter + 1, but is shorter
alert( counter ); // 3
```
- **Decrement** `--` decreases a variable by 1:

```js run no-beautify
let counter = 2;
counter--; // works the same as counter = counter - 1, but is shorter
counter--; // works the same as counter = counter - 1, but is shorter
alert( counter ); // 1
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
```js no-beautify
5 > 4 → true
"apple" > "pineapple" → false
"2" > "12" → true
undefined == null → true
undefined === null → false
"2" > "12" → true
undefined == null → true
undefined === null → false
null == "\n0\n" → false
null === +"\n0\n" → false
null === +"\n0\n" → false
```

Some of the reasons:
Expand All @@ -17,5 +17,5 @@ Some of the reasons:
3. Again, dictionary comparison, first char of `"2"` is greater than the first char of `"1"`.
4. Values `null` and `undefined` equal each other only.
5. Strict equality is strict. Different types from both sides lead to false.
6. See (4).
6. Similar to `(4)`, `null` only equals `undefined`.
7. Strict equality of different types.
5 changes: 1 addition & 4 deletions 1-js/02-first-steps/08-comparison/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ alert( '2' > 1 ); // true, string '2' becomes a number 2
alert( '01' == 1 ); // true, string '01' becomes a number 1
```

For boolean values, `true` becomes `1` and `false` becomes `0`.
For boolean values, `true` becomes `1` and `false` becomes `0`.

For example:

Expand Down Expand Up @@ -138,11 +138,8 @@ The strict equality operator is a bit longer to write, but makes it obvious what

## Comparison with null and undefined

Let's see more edge cases.

There's a non-intuitive behavior when `null` or `undefined` are compared to other values.


For a strict equality check `===`
: These values are different, because each of them is a different type.

Expand Down
1 change: 0 additions & 1 deletion 1-js/02-first-steps/10-ifelse/2-check-standard/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "
![](ifelse_task2.svg)

[demo src="ifelse_task2"]

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


```js
result = (a + b < 4) ? 'Below' : 'Over';
let result = (a + b < 4) ? 'Below' : 'Over';
```

5 changes: 3 additions & 2 deletions 1-js/02-first-steps/10-ifelse/5-rewrite-if-question/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ importance: 5

# Rewrite 'if' into '?'

Rewrite this `if` using the ternary operator `'?'`:
Rewrite this `if` using the conditional operator `'?'`:

```js
let result;

if (a + b < 4) {
result = 'Below';
} else {
result = 'Over';
}
```

4 changes: 2 additions & 2 deletions 1-js/02-first-steps/10-ifelse/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To do that, we can use the `if` statement and the conditional operator `?`, that

## The "if" statement

The `if` statement evaluates a condition and, if the condition's result is `true`, executes a block of code.
The `if(...)` statement evaluates a condition in parentheses and, if the result is `true`, executes a block of code.

For example:

Expand Down Expand Up @@ -216,7 +216,7 @@ Depending on the condition `company == 'Netscape'`, either the first or the seco

We don't assign a result to a variable here. Instead, we execute different code depending on the condition.

**We don't recommend using the question mark operator in this way.**
**It's not recommended to use the question mark operator in this way.**

The notation is shorter than the equivalent `if` statement, which appeals to some programmers. But it is less readable.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (userName == 'Admin') {
if (pass == 'TheMaster') {
alert( 'Welcome!' );
} else if (pass == '' || pass == null) {
alert( 'Canceled.' );
alert( 'Canceled' );
} else {
alert( 'Wrong password' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ importance: 3

Write the code which asks for a login with `prompt`.

If the visitor enters `"Admin"`, then `prompt` for a password, if the input is an empty line or `key:Esc` -- show "Canceled.", if it's another string -- then show "I don't know you".
If the visitor enters `"Admin"`, then `prompt` for a password, if the input is an empty line or `key:Esc` -- show "Canceled", if it's another string -- then show "I don't know you".

The password is checked as follows:

- If it equals "TheMaster", then show "Welcome!",
- Another string -- show "Wrong password",
- For an empty string or cancelled input, show "Canceled."
- For an empty string or cancelled input, show "Canceled"

The schema:

Expand Down
4 changes: 2 additions & 2 deletions 1-js/02-first-steps/11-logical-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (hour < 10 || hour > 18 || isWeekend) {
}
```

## OR finds the first truthy value
## OR "||" finds the first truthy value

The logic described above is somewhat classical. Now, let's bring in the "extra" features of JavaScript.

Expand Down Expand Up @@ -186,7 +186,7 @@ if (1 && 0) { // evaluated as true && false
```


## AND finds the first falsy value
## AND "&&" finds the first falsy value

Given multiple AND'ed values:

Expand Down
18 changes: 9 additions & 9 deletions 1-js/02-first-steps/12-while-for/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ while (condition) {
}
```

While the `condition` is `true`, the `code` from the loop body is executed.
While the `condition` is truthy, the `code` from the loop body is executed.

For instance, the loop below outputs `i` while `i < 3`:

Expand Down Expand Up @@ -84,7 +84,7 @@ This form of syntax should only be used when you want the body of the loop to ex

## The "for" loop

The `for` loop is the most commonly used loop.
The `for` loop is more complex, but it's also the most commonly used loop.

It looks like this:

Expand All @@ -111,8 +111,8 @@ Let's examine the `for` statement part-by-part:
| step| `i++` | Executes after the body on each iteration but before the condition check. |
| body | `alert(i)`| Runs again and again while the condition is truthy. |


The general loop algorithm works like this:

```
Run begin
→ (if condition → run body and run step)
Expand All @@ -121,6 +121,8 @@ Run begin
→ ...
```

That is, `begin` executes once, and then it iterates: after each `condition` test, `body` and `step` are executed.

If you are new to loops, it could help to go back to the example and reproduce how it runs step-by-step on a piece of paper.

Here's exactly what happens in our case:
Expand Down Expand Up @@ -289,8 +291,7 @@ if (i > 5) {
(i > 5) ? alert(i) : *!*continue*/!*; // continue isn't allowed here
```

...it stops working. Code like this will give a syntax error:

...it stops working: there's a syntax error.

This is just another reason not to use the question mark operator `?` instead of `if`.
````
Expand All @@ -308,8 +309,7 @@ for (let i = 0; i < 3; i++) {

let input = prompt(`Value at coords (${i},${j})`, '');

// what if I want to exit from here to Done (below)?

// what if we want to exit from here to Done (below)?
}
}

Expand Down Expand Up @@ -358,12 +358,12 @@ for (let i = 0; i < 3; i++) { ... }

The `continue` directive can also be used with a label. In this case, code execution jumps to the next iteration of the labeled loop.

````warn header="Labels are not a \"goto\""
````warn header="Labels do not allow to \"jump\" anywhere"
Labels do not allow us to jump into an arbitrary place in the code.

For example, it is impossible to do this:
```js
break label; // jumps to label? No.
break label; // doesn't jumps to the label below

label: for (...)
```
Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/13-switch/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ switch (a) {
break;

*!*
<<<<<<< HEAD
case 3: // (*) două cazuri grupate
=======
case 3: // (*) grouped two cases
>>>>>>> 852ee189170d9022f67ab6d387aeae76810b5923
case 5:
alert('Greșit!');
alert("De ce nu urmezi un curs de matematică?");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function checkAge(age) {
if (age > 18) {
return true;
} else {
return confirm('Do you have your parents permission to access this page?');
return confirm('Did parents allow you?');
}
}
```
Expand Down
Loading