Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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/02-first-steps/09-comparison/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,16 @@ Jak se přes tyto příklady přenést? Měli bychom si tyto zvláštnosti neust

## Shrnutí

<<<<<<< HEAD
- Porovnávací operátory vracejí hodnotu typu boolean.
- Řetězce se porovnávají znak po znaku podle „slovníkového“ pořadí.
- Když se porovnávají hodnoty různých typů, převedou se na čísla (s výjimkou operátoru striktní rovnosti).
- Hodnoty `null` a `undefined` se rovnají `==` sobě navzájem, ale nerovnají se žádné jiné hodnotě.
- Buďte opatrní při používání porovnávání jako `<` nebo `>` na proměnné, které mohou být `null/undefined`. Dobrý nápad je odděleně ověřit, zda opravdu jsou `null/undefined`.
=======
- Comparison operators return a boolean value.
- Strings are compared letter-by-letter in the "dictionary" order.
- When values of different types are compared, they get converted to numbers (with the exclusion of a strict equality check).
- The values `null` and `undefined` are equal `==` to themselves and each other, but do not equal any other value.
- Be careful when using comparisons like `>` or `<` with variables that can occasionally be `null/undefined`. Checking for `null/undefined` separately is a good idea.
>>>>>>> d78b01e9833009fab534462e05c03cffc51bf0e3
4 changes: 4 additions & 0 deletions 1-js/05-data-types/04-array/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ Dejme tomu, že chceme získat poslední prvek pole.

Některé programovací jazyky umožňují ke stejnému účelu použít záporné indexy, například `ovoce[-1]`.

<<<<<<< HEAD
V JavaScriptu to však nefunguje. Výsledek bude `undefined`, protože index v hranatých závorkách se zpracovává tak, jak je uveden.
=======
However, in JavaScript it won't work. The result will be `undefined`, because the index in square brackets is treated literally.
>>>>>>> d78b01e9833009fab534462e05c03cffc51bf0e3

Můžeme výslovně vypočítat index posledního prvku a pak jej použít: `ovoce[ovoce.length - 1]`.

Expand Down
10 changes: 10 additions & 0 deletions 1-js/09-classes/06-instanceof/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ Algoritmus operátoru `obj instanceof Třída` funguje zhruba následovně:
Například:

```js run
<<<<<<< HEAD
// nastavíme ověření instanceOf tak, aby předpokládalo,
// že všechno, co má vlastnost můžeŽrát, je zvíře
class Zvíře {
=======
// set up instanceof check that assumes that
// anything with canEat property is an animal
class Animal {
>>>>>>> d78b01e9833009fab534462e05c03cffc51bf0e3
static [Symbol.hasInstance](obj) {
if (obj.můžeŽrát) return true;
}
Expand All @@ -68,7 +74,11 @@ Algoritmus operátoru `obj instanceof Třída` funguje zhruba následovně:
alert(obj instanceof Zvíře); // true: zavolá se Zvíře[Symbol.hasInstance](obj)
```

<<<<<<< HEAD
2. Většina tříd nemá `Symbol.hasInstance`. V tom případě je použita standardní logika: `obj instanceOf Třída` zjistí, zda se `Třída.prototype` rovná některému z prototypů v prototypovém řetězci objektu `obj`.
=======
2. Most classes do not have `Symbol.hasInstance`. In that case, the standard logic is used: `obj instanceof Class` checks whether `Class.prototype` is equal to one of the prototypes in the `obj` prototype chain.
>>>>>>> d78b01e9833009fab534462e05c03cffc51bf0e3

Jinými slovy, porovnává jeden po druhém:
```js
Expand Down