Skip to content

Sync with upstream @ 58f6599d #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 195 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
ce70814
Update article.md
paroche Feb 7, 2020
3cab277
Confucius never said black cat quote
leeyc0 May 16, 2020
16273f9
Update article.md
leeyc0 May 18, 2020
9e678da
Update article.md
leeyc0 May 18, 2020
289833c
Change to Tao Te Ching
leeyc0 May 26, 2020
b21675a
Update article.md
leeyc0 May 26, 2020
cf64a79
Update article.md
leeyc0 May 26, 2020
edfe300
Update article.md
rromanenko Jun 23, 2020
4044b75
Fix typo
dvdvdmt Jun 27, 2020
97a12c4
Update article.md
akymtl Jun 27, 2020
1b1b07e
Update article.md
akymtl Jun 27, 2020
41a1b92
Fix typo in /instanceof section (widow -> Window)
traxium Jun 28, 2020
01e584f
update solution.md
DanGhanbari Jun 28, 2020
74caa86
Typos
peachesontour Jun 30, 2020
de25423
Typos
peachesontour Jun 30, 2020
3e2309c
Update article.md
liuernan Jul 1, 2020
ad0dd99
is 'if' operator?
lumosmind Jul 1, 2020
3eb13d5
Corrected a typo
SakiPgr Jul 2, 2020
eb49cb9
Type mistake
pushpend3r Jul 2, 2020
f0dbc65
Fixed Type
siddharth-golchha Jul 4, 2020
5ac5183
more definitive title
lumosmind Jul 4, 2020
d9ab352
Update article.md
shubham-maurya Jul 5, 2020
8a9f440
Fix error of BigInt
leviding Jul 6, 2020
1ad3c2c
Correct message in sandbox.view iframe
smakhl Jul 7, 2020
23fb044
Update task.md
leviding Jul 7, 2020
9e3065f
Fix a comment
zhang1pr Jul 9, 2020
3852623
8.4 Prototype methods... - Fix code typo
DaliborP Jul 10, 2020
15214dc
Update article.md
haond10adp Jul 10, 2020
56edf4a
minor fix: precedence is 5 according to MDN
mazharz Jul 11, 2020
72482bc
Update article.md
paroche Jul 16, 2020
de13faf
Update bindAll of lodash
leviding Jul 17, 2020
0b7266d
Browser LocalStorage capacity updated to 5 MB.
Pankajtanwarbanna Jul 17, 2020
dfcacf2
Fix minor typo error: ol number
leviding Jul 18, 2020
7480a24
Fix minor typo error: add ol number
leviding Jul 18, 2020
356d527
Fix minor typo error: change when when to when
leviding Jul 18, 2020
0d497c7
Update article.md
leviding Jul 18, 2020
d0474ae
Update article.md
leviding Jul 18, 2020
6800c2a
Update index.html
leviding Jul 18, 2020
3558415
Merge pull request #1977 from peachesontour/patch-1
iliakan Jul 18, 2020
841d750
Merge pull request #2014 from leviding/patch-20
iliakan Jul 18, 2020
55f825c
Merge pull request #2013 from leviding/patch-19
iliakan Jul 18, 2020
b947777
Merge pull request #2012 from leviding/patch-18
iliakan Jul 18, 2020
df9effe
Merge pull request #2011 from Pankajtanwarbanna/patch-1
iliakan Jul 18, 2020
ffbf1a8
Merge pull request #2010 from leviding/patch-17
iliakan Jul 18, 2020
1f6b1c7
Merge pull request #2003 from m47h4r/minor-fix-nullish-coalescing-ope…
iliakan Jul 18, 2020
859fc13
Merge pull request #2001 from haond10adp/master
iliakan Jul 18, 2020
b4dfc5d
Merge pull request #2000 from DaliborP/patch-1
iliakan Jul 18, 2020
6e0944a
Merge pull request #1999 from zhang1pr/master
iliakan Jul 18, 2020
4716d10
Merge pull request #1997 from leviding/patch-15
iliakan Jul 18, 2020
c1767e7
Merge pull request #1996 from smakhl/patch-1
iliakan Jul 18, 2020
a896d3c
Merge pull request #1995 from leviding/patch-14
iliakan Jul 18, 2020
83c01f4
Merge pull request #1993 from shubham-maurya/patch-1
iliakan Jul 18, 2020
5641b17
Merge pull request #1989 from siddharth-golchha/patch-1
iliakan Jul 18, 2020
80f7653
Merge pull request #1987 from pushpend3r/patch-1
iliakan Jul 18, 2020
67e54bf
Merge pull request #1984 from SakiPgr/patch-1
iliakan Jul 18, 2020
e251f05
Merge pull request #1983 from lumosmind/patch-40
iliakan Jul 18, 2020
918947e
Merge pull request #1980 from liuernan/patch-1
iliakan Jul 18, 2020
86222ff
Merge pull request #1978 from peachesontour/patch-2
iliakan Jul 18, 2020
83793dc
Merge pull request #1976 from DanGhanbari/patch-1
iliakan Jul 18, 2020
5e74d7c
Merge pull request #1975 from traxium/patch-1
iliakan Jul 18, 2020
04c0570
Merge pull request #1974 from akymtl/patch-3
iliakan Jul 18, 2020
6acac10
Merge pull request #1973 from akymtl/patch-1
iliakan Jul 18, 2020
668207b
Merge pull request #1972 from dvdvdmt/patch-1
iliakan Jul 18, 2020
ae11710
Merge pull request #1970 from rromanenko/patch-1
iliakan Jul 18, 2020
c2f8c4f
Update article.md
leviding Jul 18, 2020
4fdf4c3
to make binding more clear
lumosmind Jul 21, 2020
b70f949
grammatical fix
lumosmind Jul 21, 2020
f38eb4e
Merge pull request #2021 from lumosmind/patch-44
iliakan Jul 21, 2020
85b1e7a
Update article.md
haond10adp Jul 23, 2020
8f3831b
One line of code creates a lot of confusing
lumosmind Jul 23, 2020
41766c9
grammar fix
lumosmind Jul 23, 2020
8e1f438
Merge pull request #1990 from lumosmind/patch-43
iliakan Jul 23, 2020
f19c56b
BigInt header grammar fix
Jul 24, 2020
7d0d654
clarifying example code
lumosmind Jul 25, 2020
dc0d915
Typo
peachesontour Jul 25, 2020
b0464bb
Merge pull request #2028 from peachesontour/patch-1
iliakan Jul 25, 2020
1f5a40f
Update article.md
peachesontour Jul 25, 2020
ed78e26
Update article.md
peachesontour Jul 27, 2020
05e1878
refactoring
lumosmind Jul 29, 2020
cdf382d
Merge pull request #2031 from lumosmind/patch-49
iliakan Jul 29, 2020
0f391b2
Update article.md
iliakan Aug 3, 2020
0f7443b
minor fixes
iliakan Aug 4, 2020
4133532
minor fixes
iliakan Aug 4, 2020
0e592a9
minor fixes
iliakan Aug 4, 2020
d2f7d14
minor fixes
iliakan Aug 4, 2020
fb4dda6
minor fixes
iliakan Aug 4, 2020
f0ad0ba
minor fixes
iliakan Aug 4, 2020
7907cd6
minor fixes
iliakan Aug 4, 2020
beaf89f
Typos
peachesontour Aug 8, 2020
7b0d477
repeated word
joaquinelio Aug 8, 2020
d4fb59b
Merge pull request #2046 from joaquinelio/patch-1
iliakan Aug 8, 2020
bb8fc43
Typos
peachesontour Aug 8, 2020
1599dec
Merge pull request #2047 from peachesontour/patch-5
iliakan Aug 8, 2020
4ff6eb4
Various minor syntax and punctuation changes
paroche Aug 9, 2020
2aab98a
Merge pull request #2050 from javascript-tutorial/paroche-patch-19
paroche Aug 9, 2020
8d13b7f
One more little phrasing change
paroche Aug 9, 2020
0557a16
Update article.md
redradist Aug 9, 2020
1cfd422
minor fixes
iliakan Aug 9, 2020
2bf8a27
minor fixes
iliakan Aug 9, 2020
fbf443e
minor fixes
iliakan Aug 9, 2020
fe12de8
Typos
peachesontour Aug 9, 2020
8a70b74
The solution here had no break, an infinite loop.
peachesontour Aug 9, 2020
3a924fc
minor fixes
iliakan Aug 10, 2020
a6c9f30
5.4 - change 7 basic types to eight basic types
arcticmatt Aug 11, 2020
a149bc0
Fixed "compatibility" spelling error
yasath Aug 13, 2020
bc92283
Update article.md
Aug 13, 2020
6615df4
Update article.md
Aug 13, 2020
665b8eb
Merge pull request #2063 from maksumi/patch-3
iliakan Aug 14, 2020
43ff24e
[Typo Correction] - "fetch" solution typo error
C17AN Aug 14, 2020
9add5e7
Merge pull request #2065 from C17AN/patch-1
iliakan Aug 14, 2020
8eab7d6
minor fixes
iliakan Aug 14, 2020
b0624a1
minor fixes
iliakan Aug 14, 2020
665b972
delete unused line
Violet-Bora-Lee Aug 16, 2020
4550b60
Update article.md
peachesontour Aug 16, 2020
fe571b3
Merge pull request #2066 from Violet-Bora-Lee/master
iliakan Aug 16, 2020
bbaa75b
Improve phrasing
bookchiq Aug 18, 2020
2c01903
Remove Edge and Firefox warning
josephrocca Aug 21, 2020
53f055c
Merge pull request #2072 from josephrocca/patch-1
iliakan Aug 21, 2020
858b733
Update task.md
iliakan Aug 22, 2020
b85413d
Update task.md
iliakan Aug 22, 2020
a99254f
once in -> once every
joaquinelio Aug 22, 2020
9380866
Update article.md
joaquinelio Aug 23, 2020
977cc0f
Update article.md
joaquinelio Aug 23, 2020
44bc57e
Date object explained clearly
AasthaSinha2305 Aug 23, 2020
243a1d3
Update solution.md
AasthaSinha2305 Aug 23, 2020
37287af
Update solution.md
AasthaSinha2305 Aug 23, 2020
3b71f76
add semicolon
sanghyoLe Aug 23, 2020
b0c5dad
Merge pull request #2076 from AasthaSinha2305/master
iliakan Aug 24, 2020
b946ee0
Removed the parts about browser compatibility
moisheschwartz Aug 24, 2020
21b83a5
Typos
peachesontour Aug 25, 2020
1190721
Update article.md
iliakan Aug 26, 2020
c1b38c8
Update article.md
iliakan Aug 26, 2020
2a6d552
updated size unit from "kb" to "KB" - [#2085]
C17AN Aug 27, 2020
721cbed
Merge pull request #2086 from C17AN/patch-2
iliakan Aug 27, 2020
689b1c4
Merge pull request #2026 from ghost/patch-1
iliakan Aug 27, 2020
d462c7e
Merge pull request #2082 from peachesontour/patch-9
iliakan Aug 27, 2020
c28563b
Merge pull request #2078 from moisheschwartz/patch-1
iliakan Aug 27, 2020
f983992
Merge pull request #2077 from sanghyo95/patch-1
iliakan Aug 27, 2020
9007790
Merge pull request #2073 from joaquinelio/patch-1
iliakan Aug 27, 2020
71988e1
Merge pull request #2069 from bookchiq/patch-1
iliakan Aug 27, 2020
ff470ec
Merge pull request #2067 from peachesontour/patch-8
iliakan Aug 27, 2020
9646a67
Merge pull request #2062 from yasath/patch-1
iliakan Aug 27, 2020
ba6ae24
Merge pull request #2058 from arcticmatt/array-patch
iliakan Aug 27, 2020
1bd9b9e
Merge pull request #2054 from peachesontour/patch-7
iliakan Aug 27, 2020
d1ac0c4
Merge pull request #2053 from peachesontour/patch-6
iliakan Aug 27, 2020
32cf594
Merge pull request #2027 from lumosmind/patch-48
iliakan Aug 27, 2020
f885527
Merge pull request #2029 from peachesontour/patch-1
iliakan Aug 27, 2020
b07a1fe
Merge pull request #2030 from peachesontour/patch-3
iliakan Aug 27, 2020
e25ccf8
Merge pull request #2044 from peachesontour/patch-4
iliakan Aug 27, 2020
f830bc5
Merge pull request #2051 from redradist/patch-1
iliakan Aug 27, 2020
b105548
misplaced "too"?
joaquinelio Aug 30, 2020
5c4adfa
The last 2 code snippets shouldn't be runnable
peachesontour Aug 30, 2020
3aaf519
suggestion to use alert method not console.log
Violet-Bora-Lee Aug 30, 2020
4bd8ce5
fix typo and minor grammatical error
Violet-Bora-Lee Aug 30, 2020
51e5aa9
Typos
peachesontour Aug 30, 2020
b9c4dbc
Typos
peachesontour Aug 30, 2020
bcf49d1
internal link format info:
joaquinelio Aug 31, 2020
0bfebb4
Merge pull request #2097 from joaquinelio/patch-2
iliakan Aug 31, 2020
4830a26
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
d929841
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
2881c97
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
0017800
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
751f78a
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
2b5502a
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
8d71d86
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
be28fe2
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
0003221
Update article.md
peachesontour Sep 1, 2020
cb9542b
Update 2-ui/99-ui-misc/03-event-loop/article.md
peachesontour Sep 1, 2020
6895d38
Update 2-ui/99-ui-misc/03-event-loop/article.md
peachesontour Sep 1, 2020
cd3fb86
Update 2-ui/99-ui-misc/01-mutation-observer/article.md
peachesontour Sep 1, 2020
2f4747b
minor fixes
iliakan Sep 3, 2020
c658bb3
add missing closing bracket
yoga1234 Sep 3, 2020
c1cd076
Update article.md
hsnilsson Sep 4, 2020
2bf5add
Typo
pushpend3r Sep 4, 2020
c0d638a
minor fixes
iliakan Sep 5, 2020
2f1f6a1
Merge pull request #2100 from yoga1234/patch-1
iliakan Sep 5, 2020
7fd4f7d
Merge pull request #2101 from henchies/patch-2
iliakan Sep 5, 2020
d1e4981
Merge pull request #2102 from pushpend3r/patch-2
iliakan Sep 5, 2020
6701d9b
Merge pull request #2096 from peachesontour/patch-12
iliakan Sep 5, 2020
30386fc
Merge pull request #2095 from peachesontour/patch-11
iliakan Sep 5, 2020
952c13a
minor fixes
iliakan Sep 5, 2020
d36db20
Merge pull request #2094 from Violet-Bora-Lee/mouse-event-typo
iliakan Sep 5, 2020
92e9028
Merge pull request #2093 from Violet-Bora-Lee/class-inheritance-sugge…
iliakan Sep 5, 2020
0b7f426
Merge pull request #2092 from peachesontour/patch-10
iliakan Sep 5, 2020
fe6e352
Merge pull request #2091 from joaquinelio/patch-1
iliakan Sep 5, 2020
94279ab
Merge pull request #1738 from javascript-tutorial/paroche-patch-18
iliakan Sep 5, 2020
c1a3778
Merge pull request #1907 from leeyc0/patch-1
iliakan Sep 5, 2020
88ad89f
Merge pull request #2015 from leviding/patch-21
iliakan Sep 5, 2020
ba5424a
minor fixes
iliakan Sep 5, 2020
edc6126
Merge pull request #2024 from lumosmind/patch-47
iliakan Sep 5, 2020
ffa154d
Merge pull request #2023 from haond10adp/master
iliakan Sep 5, 2020
2aa7e55
minor fixes
iliakan Sep 5, 2020
a9c170a
minor fixes
iliakan Sep 5, 2020
58f6599
minor fixes
iliakan Sep 5, 2020
38df5ed
merging all conflicts
iliakan Sep 7, 2020
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
8 changes: 8 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,18 @@ Moderne Werkzeuge machen die Transpilation sehr schnell und transparent und erla

Beispiele für solche Sprachen sind:

<<<<<<< HEAD
- [CoffeeScript](http://coffeescript.org/) ist ein "syntactic sugar" für JavaScript. Es führt eine kürzere Syntax ein, was uns erlaubt, klareren und präziseren Code zu schreiben. Usually, Ruby devs like it.
- [TypeScript](http://www.typescriptlang.org/) ist darauf konzentriert "strict data typing" hinzuzufügen. TypeScript verfolg das Ziel den Entwicklungsprozess und den Support für komplexe Systeme zu vereinfachen. Die Sprache wurde von Microsoft entwickelt.
- [Flow](http://flow.org/) fügt auch "data typing" hinzu, aber auf eine andere Art und Weise. Sie wurde von Facebook entwickelt.
- [Dart](https://www.dartlang.org/) ist eine eigenständige Sprache, die eine eigene Engine hat, die in Nicht-Browser-Umgebungen (wie z.B. mobilen Anwendungen) läuft, aber auch in JavaScript umgesetzt werden kann. Sie wurde von Google entwickelt.
=======
- [CoffeeScript](http://coffeescript.org/) is a "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
- [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.
- [Flow](http://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
- [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.
- [Brython](https://brython.info/) is a Python transpiler to JavaScript that allow to write application in pure Python without JavaScript.
>>>>>>> 58f6599df71b8d50417bb0a52b1ebdc995614017

Es gibt noch mehr. Auch wenn wir eine der transpilierten Sprachen verwenden sollten wir auch JavaScript trozdem kennen. Es ist wichtig zu verstehen, was im Hintergrund passiert und was wir eigentlich tun.

Expand Down
13 changes: 13 additions & 0 deletions 1-js/02-first-steps/05-types/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ Mehr über das Arbeiten mit Zahlen erfahren wir in diesem Kapitel <info:number>.

## BigInt

<<<<<<< HEAD
In JavaScript kann der Typ "Zahl" keine ganzzahligen Werte darstellen, die größer als <code>(2<sup>53</sup>-1)</code> (das ist `9007199254740991`) oder kleiner als <code>-(-2<sup>53</sup>-1)</code> für Negative sind. Es handelt sich um eine technische Einschränkung, die durch ihre interne Darstellung bedingt ist.
=======
In JavaScript, the "number" type cannot represent integer values larger than <code>(2<sup>53</sup>-1)</code> (that's `9007199254740991`), or less than <code>-(2<sup>53</sup>-1)</code> for negatives. It's a technical limitation caused by their internal representation.
>>>>>>> 58f6599df71b8d50417bb0a52b1ebdc995614017

Für die meisten Zwecke reicht das völlig aus, aber manchmal brauchen wir wirklich große Zahlen, z.B. für die Kryptographie oder Zeitstempel mit Mikrosekunden-Genauigkeit.

Expand All @@ -81,8 +85,13 @@ const bigInt = 1234567890123456789012345678901234567890n;

Da `BigInt`-Zahlen selten benötigt werden, behandeln wir sie hier nicht, sondern widmen ihnen ein eigenes Kapitel <info:bigint>. Lies es, wenn du so große Zahlen brauchst.

<<<<<<< HEAD
```smart header="Compatability issues"
Im Moment wird `BigInt` in Firefox/Chrome/Edge unterstützt, aber nicht in Safari/IE.
=======
```smart header="Compatibility issues"
Right now `BigInt` is supported in Firefox/Chrome/Edge, but not in Safari/IE.
>>>>>>> 58f6599df71b8d50417bb0a52b1ebdc995614017
```

## String
Expand Down Expand Up @@ -127,7 +136,11 @@ In diesem Kapitel werden wir uns eingehender mit Strings befassen <info:string>.
```smart header="Es gibt keinen *Zeichen*-Typ."
In einigen Sprachen gibt es einen speziellen "Zeichen"-Typ für ein einzelnes Zeichen. In der C-Sprache und in Java heißt er beispielsweise "char".

<<<<<<< HEAD
In JavaScript gibt es so einen Typ nicht. Es gibt nur einen Typ: `string`. Eine Zeichenfolge kann aus nur einem oder mehreren Zeichen bestehen.
=======
In JavaScript, there is no such type. There's only one type: `string`. A string may consist of zero characters (be empty), one character or many of them.
>>>>>>> 58f6599df71b8d50417bb0a52b1ebdc995614017
```

## Boolean (logische Werte)
Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/06-alert-prompt-confirm/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Da wir den Browser als unsere Demo-Umgebung verwenden, wollen wir einige Funktio

## alert

<<<<<<< HEAD
Diese haben wir bereits gesehen. Es zeigt eine Meldung an und wartet darauf, dass der Benutzer "OK" drückt.
=======
This one we've seen already. It shows a message and waits for the user to press "OK".
>>>>>>> 58f6599df71b8d50417bb0a52b1ebdc995614017

Zum Beispiel:

Expand Down
2 changes: 1 addition & 1 deletion 1-js/02-first-steps/10-ifelse/article.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Conditional operators: if, '?'
# Conditional branching: if, '?'

Sometimes, we need to perform different actions based on different conditions.

Expand Down
5 changes: 5 additions & 0 deletions 1-js/02-first-steps/11-logical-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,13 @@ Die Präzedenz der Operators UND `&&` ist höher als die von ODER `||`.
Der Code `a && b || c && d` verhält sich daher i.w. so, als ob die Ausdrücke mit `&&` in Klammern gesetzt würden: `(a && b) || (c && d)`.
````

<<<<<<< HEAD
````warn header="Ersetze `if` nicht durch || oder &&"
Manchmal wird der Operator UND `&&` als "Kürzel zum Schreiben von `if`" verwendet.
=======
````warn header="Don't replace `if` with || or &&"
Sometimes, people use the AND `&&` operator as a "shorter way to write `if`".
>>>>>>> 58f6599df71b8d50417bb0a52b1ebdc995614017

Beispiel:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Which behavior is better depends on a particular use case. When zero height is a

## Precedence

The precedence of the `??` operator is rather low: `7` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table).
The precedence of the `??` operator is rather low: `5` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table).

So `??` is evaluated after most other operations, but before `=` and `?`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function pow(x,n) // <- no space between arguments

let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
// but better make it 2 lines, also there's no spaces and missing ;
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
if (n<=0) // <- no spaces inside (n <= 0), and should be extra line above it
{ // <- figure bracket on a separate line
// below - long lines can be split into multiple lines for improved readability
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
Expand All @@ -39,7 +39,7 @@ function pow(x, n) {
let x = prompt("x?", "");
let n = prompt("n?", "");

if (n < 0) {
if (n <= 0) {
alert(`Power ${n} is not supported,
please enter an integer number greater than zero`);
} else {
Expand Down
6 changes: 3 additions & 3 deletions 1-js/03-code-quality/04-ninja-code/article.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ninja code


```quote author="Confucius"
```quote author="Confucius (Analects)"
Learning without thought is labor lost; thought without learning is perilous.
```

Expand Down Expand Up @@ -104,8 +104,8 @@ A quick read of such code becomes impossible. And when there's a typo... Ummm...

## Smart synonyms

```quote author="Confucius"
The hardest thing of all is to find a black cat in a dark room, especially if there is no cat.
```quote author="Laozi (Tao Te Ching)"
The Tao that can be told is not the eternal Tao. The name that can be named is not the eternal name.
```

Using *similar* names for *same* things makes life more interesting and shows your creativity to the public.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/03-garbage-collection/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Simply put, "reachable" values are those that are accessible or usable somehow.

2. Any other value is considered reachable if it's reachable from a root by a reference or by a chain of references.

For instance, if there's an object in a local variable, and that object has a property referencing another object, that object is considered reachable. And those that it references are also reachable. Detailed examples to follow.
For instance, if there's an object in a global variable, and that object has a property referencing another object, that object is considered reachable. And those that it references are also reachable. Detailed examples to follow.

There's a background process in the JavaScript engine that is called [garbage collector](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)). It monitors all objects and removes those that have become unreachable.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/07-optional-chaining/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ If there's no variable `user` at all, then `user?.anything` triggers an error:
// ReferenceError: user is not defined
user?.address;
```
There must be `let/const/var user`. The optional chaining works only for declared variables.
There must be `let/const/var user`. The optional chaining works only for declared variables.
````

## Short-circuiting
Expand Down
4 changes: 2 additions & 2 deletions 1-js/04-object-basics/08-symbol/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ user.id = "Their id value"
// Boom! overwritten by another script!
```

### Symbols in a literal
### Symbols in an object literal

If we want to use a symbol in an object literal `{...}`, we need square brackets around it.

Expand All @@ -133,7 +133,7 @@ let id = Symbol("id");
let user = {
name: "John",
*!*
[id]: 123 // not "id: 123"
[id]: 123 // not "id": 123
*/!*
};
```
Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/09-object-toprimitive/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ There are three variants of type conversion, so-called "hints", described in the
`"default"`
: Occurs in rare cases when the operator is "not sure" what type to expect.

For instance, binary plus `+` can work both with strings (concatenates them) and numbers (adds them), so both strings and numbers would do. So if the a binary plus gets an object as an argument, it uses the `"default"` hint to convert it.
For instance, binary plus `+` can work both with strings (concatenates them) and numbers (adds them), so both strings and numbers would do. So if a binary plus gets an object as an argument, it uses the `"default"` hint to convert it.

Also, if an object is compared using `==` with a string, number or a symbol, it's also unclear which conversion should be done, so the `"default"` hint is used.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/04-array/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ An array is a special kind of object. The square brackets used to access a prope

They extend objects providing special methods to work with ordered collections of data and also the `length` property. But at the core it's still an object.

Remember, there are only 7 basic types in JavaScript. Array is an object and thus behaves like an object.
Remember, there are only eight basic data types in JavaScript (see the [Data types](info:types) chapter for more info). Array is an object and thus behaves like an object.

For instance, it is copied by reference:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ function Calculator() {
let split = str.split(' '),
a = +split[0],
op = split[1],
b = +split[2]
b = +split[2];

if (!this.methods[op] || isNaN(a) || isNaN(b)) {
return NaN;
}

return this.methods[op](a, b);
}
};

this.addMethod = function(name, func) {
this.methods[name] = func;
Expand Down
4 changes: 2 additions & 2 deletions 1-js/05-data-types/06-iterable/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ alert( str.slice(1, 3) ); // garbage (two pieces from different surrogate pairs)
Objects that can be used in `for..of` are called *iterable*.

- Technically, iterables must implement the method named `Symbol.iterator`.
- The result of `obj[Symbol.iterator]` is called an *iterator*. It handles the further iteration process.
- The result of `obj[Symbol.iterator]()` is called an *iterator*. It handles the further iteration process.
- An iterator must have the method named `next()` that returns an object `{done: Boolean, value: any}`, here `done:true` denotes the end of the iteration process, otherwise the `value` is the next value.
- The `Symbol.iterator` method is called automatically by `for..of`, but we also can do it directly.
- Built-in iterables like strings or arrays, also implement `Symbol.iterator`.
Expand All @@ -304,4 +304,4 @@ Objects that have indexed properties and `length` are called *array-like*. Such

If we look inside the specification -- we'll see that most built-in methods assume that they work with iterables or array-likes instead of "real" arrays, because that's more abstract.

`Array.from(obj[, mapFn, thisArg])` makes a real `Array` of an iterable or array-like `obj`, and we can then use array methods on it. The optional arguments `mapFn` and `thisArg` allow us to apply a function to each item.
`Array.from(obj[, mapFn, thisArg])` makes a real `Array` from an iterable or array-like `obj`, and we can then use array methods on it. The optional arguments `mapFn` and `thisArg` allow us to apply a function to each item.
14 changes: 12 additions & 2 deletions 1-js/05-data-types/11-date/1-new-date/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ The `new Date` constructor uses the local time zone. So the only important thing

So February has number 1.

Here's an example with numbers as date components:

```js run
//new Date(year, month, date, hour, minute, second, millisecond)
let d1 = new Date(2012, 1, 20, 3, 12);
alert( d1 );
```
We could also create a date from a string, like this:

```js run
let d = new Date(2012, 1, 20, 3, 12);
alert( d );
//new Date(datastring)
let d2 = new Date("February 20, 2012 03:12:00");
alert( d2 );
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function func() {
func();
```

In this example we can observe the peculiar difference between a "non-existing" and "unitialized" variable.
In this example we can observe the peculiar difference between a "non-existing" and "uninitialized" variable.

As you may have read in the article [](info:closure), a variable starts in the "uninitialized" state from the moment when the execution enters a code block (or a function). And it stays uninitalized until the corresponding `let` statement.

Expand Down
12 changes: 8 additions & 4 deletions 1-js/06-advanced-functions/03-closure/article.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

# Variable scope
# Variable scope, closure

JavaScript is a very function-oriented language. It gives us a lot of freedom. A function can be created dynamically, passed as an argument to another function and called from a totally different place of code later.
JavaScript is a very function-oriented language. It gives us a lot of freedom. A function can be created at any moment, passed as an argument to another function, and then called from a totally different place of code later.

We already know that a function can access variables outside of it.
We already know that a function can access variables outside of it ("outer" variables).

Now let's expand our knowledge to include more complex scenarios.
But what happens if outer variables change since a function is created? Will the function get newer values or the old ones?

And what if a function is passed along as a parameter and called from another place of code, will it get access to outer variables at the new place?

Let's expand our knowledge to understand these scenarios and more complex ones.

```smart header="We'll talk about `let/const` variables here"
In JavaScript, there are 3 ways to declare a variable: `let`, `const` (the modern ones), and `var` (the remnant of the past).
Expand Down
4 changes: 2 additions & 2 deletions 1-js/06-advanced-functions/05-global-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The global object provides variables and functions that are available anywhere.

In a browser it is named `window`, for Node.js it is `global`, for other environments it may have another name.

Recently, `globalThis` was added to the language, as a standardized name for a global object, that should be supported across all environments. In some browsers, namely non-Chromium Edge, `globalThis` is not yet supported, but can be easily polyfilled.
Recently, `globalThis` was added to the language, as a standardized name for a global object, that should be supported across all environments. It's supported in all major browsers.

We'll use `window` here, assuming that our environment is a browser. If your script may run in other environments, it's better to use `globalThis` instead.

Expand Down Expand Up @@ -81,7 +81,7 @@ if (!window.Promise) {
That includes JavaScript built-ins, such as `Array` and environment-specific values, such as `window.innerHeight` -- the window height in the browser.
- The global object has a universal name `globalThis`.

...But more often is referred by "old-school" environment-specific names, such as `window` (browser) and `global` (Node.js). As `globalThis` is a recent proposal, it's not supported in non-Chromium Edge (but can be polyfilled).
...But more often is referred by "old-school" environment-specific names, such as `window` (browser) and `global` (Node.js).
- We should store values in the global object only if they're truly global for our project. And keep their number at minimum.
- In-browser, unless we're using [modules](info:modules), global functions and variables declared with `var` become a property of the global object.
- To make our code future-proof and easier to understand, we should access properties of the global object directly, as `window.x`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ importance: 5

The result of `debounce(f, ms)` decorator is a wrapper that suspends calls to `f` until there's `ms` milliseconds of inactivity (no calls, "cooldown period"), then invokes `f` once with the latest arguments.

In other words, `debounce` is like a secretary that accepts "phone calls", and waits until there's `ms` milliseconds of being quiet. And only then it transfers the latest call information to "the boss" (calls the actual `f`).

For instance, we had a function `f` and replaced it with `f = debounce(f, 1000)`.

Then if the wrapped function is called at 0ms, 200ms and 500ms, and then there are no calls, then the actual `f` will be only called once, at 1500ms. That is: after the cooldown period of 1000ms from the last call.
Expand All @@ -14,7 +16,7 @@ Then if the wrapped function is called at 0ms, 200ms and 500ms, and then there a

...And it will get the arguments of the very last call, other calls are ignored.

Here's the code for it (uses the debounce decorator from the [Lodash library](https://lodash.com/docs/4.17.15#debounce):
Here's the code for it (uses the debounce decorator from the [Lodash library](https://lodash.com/docs/4.17.15#debounce)):

```js
let f = _.debounce(alert, 1000);
Expand All @@ -25,7 +27,6 @@ setTimeout( () => f("c"), 500);
// debounced function waits 1000ms after the last call and then runs: alert("c")
```


Now a practical example. Let's say, the user types something, and we'd like to send a request to the server when the input is finished.

There's no point in sending the request for every character typed. Instead we'd like to wait, and then process the whole result.
Expand All @@ -43,9 +44,8 @@ See? The second input calls the debounced function, so its content is processed

So, `debounce` is a great way to process a sequence of events: be it a sequence of key presses, mouse movements or something else.


It waits the given time after the last call, and then runs its function, that can process the result.

The task is to implement `debounce` decorator.

Hint: that's just a few lines if you think about it :)
Hint: that's just a few lines if you think about it :)
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ importance: 5

Create a "throttling" decorator `throttle(f, ms)` -- that returns a wrapper.

When it's called multiple times, it passes the call to `f` at maximum once per `ms` milliseconds.
When it's called multiple times, it passes the call to `f` at maximum once per `ms` milliseconds.

The difference with debounce is that it's completely different decorator:
- `debounce` runs the function once after the "cooldown" period. Good for processing the final result.
- `throttle` runs it not more often than given `ms` time. Good for regular updates that shouldn't be very often.

In other words, `throttle` is like a secretary that accepts phone calls, but bothers the boss (calls the actual `f`) not more often than once per `ms` milliseconds.

Let's check the real-life application to better understand that requirement and to see where it comes from.

**For instance, we want to track mouse movements.**
Expand Down
Loading