Skip to content

Navigation Menu

Sign in
Sign up

Sync with upstream @ 51bc6d3c #230

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
javascript-translate-bot wants to merge 4 commits into master from sync-51bc6d3c
Closed
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
10 changes: 10 additions & 0 deletions 1-js/09-classes/06-instanceof/article.md
View file Open in desktop
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 {
>>>>>>> 51bc6d3cdc16b6eb79cb88820a58c4f037f3bf19
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.
>>>>>>> 51bc6d3cdc16b6eb79cb88820a58c4f037f3bf19

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

AltStyle によって変換されたページ (->オリジナル) /