Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
7267abd
Update article.md
nikandev Aug 28, 2022
c11e773
Clarify instructions of `read` method
0xEddie Aug 28, 2022
e09ea79
Update task.md
0xEddie Aug 28, 2022
a0d6b52
Fix typo
KilianSorel Aug 30, 2022
5abfab9
Minor grammar
davidshq Sep 6, 2022
a6f19fb
Update article.md
davidshq Sep 6, 2022
0c6a4ac
Update article.md
davidshq Sep 6, 2022
131a3a7
Minor grammar
davidshq Sep 6, 2022
11eef4c
👾 add mdn links to Map and Set methods
Rnbsov Sep 6, 2022
82156c4
👾 smth
Rnbsov Sep 6, 2022
5f2b5a8
Update article.md
gleachkr Sep 9, 2022
4a3e70e
Update task.md | Fix grammar
mukulkandhari Sep 9, 2022
0f2d22c
Update solution.md
mukulkandhari Sep 9, 2022
f15700d
Update article.md
gleachkr Sep 10, 2022
026b1c4
Update String type chapter
chilipenko Sep 15, 2022
2672263
Merge pull request #3166 from nikandev/patch-1
iliakan Sep 20, 2022
588e213
Merge pull request #3167 from 0xEddie/master
iliakan Sep 20, 2022
b4bbee6
closes #3168
iliakan Sep 20, 2022
4b5ff83
Merge pull request #3170 from KilianSorel/patch-1
iliakan Sep 20, 2022
55be282
Merge pull request #3174 from davidshq/patch-1
iliakan Sep 20, 2022
83b7de0
Merge pull request #3176 from davidshq/patch-3
iliakan Sep 20, 2022
b0a86b9
minor fixes
iliakan Sep 20, 2022
89e3a75
Merge pull request #3177 from davidshq/patch-4
iliakan Sep 20, 2022
b2586ee
Merge pull request #3178 from Rnbsov/patch-74
iliakan Sep 20, 2022
202e625
Merge pull request #3180 from gleachkr/patch-1
iliakan Sep 20, 2022
42b7197
Merge pull request #3181 from mukulkandhari/patch-2
iliakan Sep 20, 2022
44dc8eb
fix markdown syntax
Sep 21, 2022
bbb50e7
Merge pull request #3175 from davidshq/patch-2
iliakan Sep 21, 2022
c2342c1
minor fixes
iliakan Sep 21, 2022
7c05948
Merge pull request #3187 from chilipenko/patch-1
iliakan Sep 21, 2022
f5511ee
minor fixes
iliakan Sep 21, 2022
712f47e
minor fixes
iliakan Sep 21, 2022
4d59152
Merge pull request #3192 from tianheg/patch-1
iliakan Sep 21, 2022
c990cda
Merge pull request #3182 from mukulkandhari/patch-3
iliakan Sep 21, 2022
e7424d4
typo
joaquinelio Sep 23, 2022
2b022ee
Merge pull request #3194 from joaquinelio/patch-13
iliakan Sep 23, 2022
9e649fb
Update task.md
Sep 23, 2022
ff4ef57
minor fixes
iliakan Sep 24, 2022
dfb97dc
fix a small typo
Sep 24, 2022
a4877df
fix typo
skromez Sep 24, 2022
1575b8a
fix small typo
Sep 24, 2022
86ed165
grammar suggestion
Sep 24, 2022
1b87b89
Omitting parentheses after `new`
web-dev-sam Sep 25, 2022
a965e49
typo
joaquinelio Sep 27, 2022
4c693a2
Update article.md
skromez Sep 27, 2022
1292386
typo
joaquinelio Sep 28, 2022
fe525d2
Change link to the spec
romanstetsyk Sep 28, 2022
f2ef231
Fix typo "stirng" to "string"
ann-kilzer Sep 29, 2022
8d89b7f
ECMA broken link
joaquinelio Sep 29, 2022
24dfb1f
Remove description of inconsistency between Chrome and Firefox
wdscxsj Sep 29, 2022
594bc55
https link
joaquinelio Sep 29, 2022
15ab2fd
Merge pull request #3209 from joaquinelio/patch-18
iliakan Sep 30, 2022
fde193a
Merge pull request #3208 from wdscxsj/patch-1
iliakan Sep 30, 2022
63bc08e
Merge pull request #3207 from joaquinelio/patch-17
iliakan Sep 30, 2022
4d42242
Merge pull request #3206 from ann-kilzer/patch-1
iliakan Sep 30, 2022
dc6e7d1
Merge pull request #3205 from romanstetsyk/master
iliakan Sep 30, 2022
e0621be
Merge pull request #3202 from joaquinelio/patch-15
iliakan Oct 1, 2022
4a9dc8e
Merge pull request #3204 from joaquinelio/patch-16
iliakan Oct 1, 2022
c8b4d34
move Unicode to a separate article
iliakan Oct 1, 2022
98d0c2c
Merge pull request #3201 from MindLaborDev/patch-1
iliakan Oct 1, 2022
b24e3fb
Merge pull request #3200 from digital-bw/patch-4
iliakan Oct 1, 2022
586cc54
Merge pull request #3199 from digital-bw/patch-3
iliakan Oct 1, 2022
2cb64ab
Merge pull request #3198 from skromez/master
iliakan Oct 1, 2022
2180da8
Merge pull request #3197 from digital-bw/patch-2
iliakan Oct 1, 2022
aedeed3
Merge pull request #3195 from digital-bw/patch-1
iliakan Oct 1, 2022
c27a7b4
closes #3185
iliakan Oct 1, 2022
c589176
closes #3183
iliakan Oct 1, 2022
666f356
closes #3190
iliakan Oct 1, 2022
c99d740
closes #3179
iliakan Oct 1, 2022
18b1314
closes #3096
iliakan Oct 2, 2022
9b4955e
merging all conflicts
iliakan Oct 3, 2022
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
13 changes: 12 additions & 1 deletion 1-js/02-first-steps/04-variables/3-uppercast-constant/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@ const datumNarození = '18.04.1982';
const věk = nějakýKód(datumNarození);
```

<<<<<<< HEAD
Zde máme konstantu `datumNarození` a pomocí nějakého kódu se z této proměnné vypočítá `věk` (kód není pro stručnost uveden, na podrobnostech zde nezáleží).
=======
Here we have a constant `birthday` for the date, and also the `age` constant.

The `age` is calculated from `birthday` using `someCode()`, which means a function call that we didn't explain yet (we will soon!), but the details don't matter here, the point is that `age` is calculated somehow based on the `birthday`.
>>>>>>> 18b1314af4e0ead5a2b10bb4bacd24cecbb3f18e

Bylo by správné použít pro název proměnné `datumNarození` velká písmena? A pro `věk`? Nebo dokonce pro obě?

```js
<<<<<<< HEAD
const DATUM_NAROZENÍ = '18.04.1982'; // velkými písmeny?

const VĚK = nějakýKód(DATUM_NAROZENÍ); // velkými písmeny?
```
=======
const BIRTHDAY = '18.04.1982'; // make birthday uppercase?

const AGE = someCode(BIRTHDAY); // make age uppercase?
>>>>>>> 18b1314af4e0ead5a2b10bb4bacd24cecbb3f18e
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ undefined + 1 = NaN // (6)
" \t \n" - 2 = -2 // (7)
```

<<<<<<< HEAD
1. Sčítání s řetězcem `"" + 1` převede `1` na řetězec: `"" + 1 = "1"`, pak tedy budeme mít `"1" + 0` a použije se stejné pravidlo.
2. Odčítání `-` (stejně jako většina matematických operací) pracuje jen s čísly, takže převede prázdný řetězec `""` na `0`.
3. Sčítání s řetězcem připojí k řetězci číslo `5`.
4. Odčítání vždy převádí operandy na čísla, takže vyrobí z `" -9 "` číslo `-9` (mezery okolo něj se ignorují).
5. `null` se převede na číslo `0`.
6. `undefined` se převede na číslo `NaN`.
7. Když se řetězec převádí na číslo, mezerové znaky se z jeho začátku a konce odříznou. V tomto případě se celý řetězec skládá z mezerových znaků, konkrétně `\t`, `\n` a „obyčejné“ mezery mezi nimi. Stejně jako prázdný řetězec se tedy převede na `0`.
=======
1. The addition with a string `"" + 1` converts `1` to a string: `"" + 1 = "1"`, and then we have `"1" + 0`, the same rule is applied.
2. The subtraction `-` (like most math operations) only works with numbers, it converts an empty string `""` to `0`.
3. The addition with a string appends the number `5` to the string.
4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).
5. `null` becomes `0` after the numeric conversion.
6. `undefined` becomes `NaN` after the numeric conversion.
7. Space characters are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.
>>>>>>> 18b1314af4e0ead5a2b10bb4bacd24cecbb3f18e
25 changes: 16 additions & 9 deletions 1-js/04-object-basics/02-object-copy/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,17 @@ We can also use the method [Object.assign](https://developer.mozilla.org/en-US/d
The syntax is:

```js
Object.assign(dest, src1[, src2, src3...])
Object.assign(dest, ...sources)
```

- The first argument `dest` is a target object.
- Further arguments `src1, ..., srcN` (can be as many as needed) are source objects.
- It copies the properties of all source objects `src1, ..., srcN` into the target `dest`. In other words, properties of all arguments starting from the second are copied into the first object.
- The call returns `dest`.
- Further arguments is a list of source objects.

For instance, we can use it to merge several objects into one:
```js
It copies the properties of all source objects into the target `dest`, and then returns it as the result.

For example, we have `user` object, let's add a couple of permissions to it:

```js run
let user = { name: "John" };

let permissions1 = { canView: true };
Expand All @@ -181,6 +182,9 @@ Object.assign(user, permissions1, permissions2);
*/!*

// now user = { name: "John", canView: true, canEdit: true }
alert(user.name); // John
alert(user.canView); // true
alert(user.canEdit); // true
```

If the copied property name already exists, it gets overwritten:
Expand All @@ -193,9 +197,9 @@ Object.assign(user, { name: "Pete" });
alert(user.name); // now user = { name: "Pete" }
```

We also can use `Object.assign` to replace `for..in` loop for simple cloning:
We also can use `Object.assign` to perform a simple object cloning:

```js
```js run
let user = {
name: "John",
age: 30
Expand All @@ -204,9 +208,12 @@ let user = {
*!*
let clone = Object.assign({}, user);
*/!*

alert(clone.name); // John
alert(clone.age); // 30
```

It copies all properties of `user` into the empty object and returns it.
Here it copies all properties of `user` into the empty object and returns it.

There are also other methods of cloning an object, e.g. using the [spread syntax](info:rest-parameters-spread) `clone = {...user}`, covered later in the tutorial.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Is it possible to create functions `A` and `B` so that `new A() == new B()`?
function A() { ... }
function B() { ... }

let a = new A;
let b = new B;
let a = new A();
let b = new B();

alert( a == b ); // true
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ importance: 5

Create a constructor function `Calculator` that creates objects with 3 methods:

- `read()` asks for two values using `prompt` and remembers them in object properties.
- `read()` prompts for two values and saves them as object properties with names `a` and `b` respectively.
- `sum()` returns the sum of these properties.
- `mul()` returns the multiplication product of these properties.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/06-constructor-new/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ alert( new SmallUser().name ); // John
Usually constructors don't have a `return` statement. Here we mention the special behavior with returning objects mainly for the sake of completeness.

````smart header="Omitting parentheses"
By the way, we can omit parentheses after `new`, if it has no arguments:
By the way, we can omit parentheses after `new`:

```js
let user = new User; // <-- no parentheses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ Note that `63.5` has no precision loss at all. That's because the decimal part `


```js run
alert( Math.round(6.35 * 10) / 10); // 6.35 -> 63.5 -> 64(rounded) -> 6.4
alert( Math.round(6.35 * 10) / 10 ); // 6.35 -> 63.5 -> 64(rounded) -> 6.4
```

4 changes: 2 additions & 2 deletions 1-js/05-data-types/02-number/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ Please note that an empty or a space-only string is treated as `0` in all numeri

```js run
alert( Number.isFinite(123) ); // true
alert( Number.isFinite(Infinity) ); //false
alert( Number.isFinite(Infinity) ); // false
alert( Number.isFinite(2 / 0) ); // false

// Note the difference:
Expand All @@ -367,7 +367,7 @@ In a way, `Number.isNaN` and `Number.isFinite` are simpler and more straightforw
There is a special built-in method `Object.is` that compares values like `===`, but is more reliable for two edge cases:

1. It works with `NaN`: `Object.is(NaN, NaN) === true`, that's a good thing.
2. Values `0` and `-0` are different: `Object.is(0, -0) === false`, technically that's true, because internally the number has a sign bit that may be different even if all other bits are zeroes.
2. Values `0` and `-0` are different: `Object.is(0, -0) === false`, technically that's correct, because internally the number has a sign bit that may be different even if all other bits are zeroes.

In all other cases, `Object.is(a, b)` is the same as `a === b`.

Expand Down
8 changes: 1 addition & 7 deletions 1-js/05-data-types/03-string/1-ucfirst/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ let newStr = str[0].toUpperCase() + str.slice(1);

There's a small problem though. If `str` is empty, then `str[0]` is `undefined`, and as `undefined` doesn't have the `toUpperCase()` method, we'll get an error.

There are two variants here:

1. Use `str.charAt(0)`, as it always returns a string (maybe empty).
2. Add a test for an empty string.

Here's the 2nd variant:
The easiest way out is to add a test for an empty string, like this:

```js run demo
function ucFirst(str) {
Expand All @@ -24,4 +19,3 @@ function ucFirst(str) {

alert( ucFirst("john") ); // John
```

Loading