diff --git a/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/solution.md b/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/solution.md index 7d8edd7ca..8f23cac8d 100644 --- a/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/solution.md +++ b/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/solution.md @@ -1,8 +1,8 @@ -Yes, it's possible. +Ano, je to možné. -If a function returns an object then `new` returns it instead of `this`. +Jestliže funkce vrací objekt, pak jej `new` vrátí místo `this`. -So they can, for instance, return the same externally defined object `obj`: +Mohou tedy například vrátit stejný externě definovaný objekt `obj`: ```js run no-beautify let obj = {}; diff --git a/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/task.md b/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/task.md index e932a201a..f4cff1f19 100644 --- a/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/task.md +++ b/1-js/04-object-basics/06-constructor-new/1-two-functions-one-object/task.md @@ -2,9 +2,9 @@ importance: 2 --- -# Two functions – one object +# Dvě funkce – jeden objekt -Is it possible to create functions `A` and `B` so that `new A() == new B()`? +Je možné vytvořit funkce `A` a `B` tak, aby `new A() == new B()`? ```js no-beautify function A() { ... } @@ -16,4 +16,4 @@ let b = new B(); alert( a == b ); // true ``` -If it is, then provide an example of their code. +Pokud ano, uveďte příklad jejich kódu. diff --git a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/solution.js b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/solution.js index 3b51b2e69..ef30542f2 100644 --- a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/solution.js +++ b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/solution.js @@ -1,15 +1,15 @@ -function Calculator() { +function Kalkulátor() { - this.read = function() { + this.načti = function() { this.a = +prompt('a?', 0); this.b = +prompt('b?', 0); }; - this.sum = function() { + this.součet = function() { return this.a + this.b; }; - this.mul = function() { + this.součin = function() { return this.a * this.b; }; } \ No newline at end of file diff --git a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/test.js b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/test.js index bba80e5c2..19afc9dbe 100644 --- a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/test.js +++ b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/_js.view/test.js @@ -1,27 +1,27 @@ -describe("calculator", function() { - let calculator; +describe("kalkulátor", function() { + let kalkulátor; before(function() { sinon.stub(window, "prompt") prompt.onCall(0).returns("2"); prompt.onCall(1).returns("3"); - calculator = new Calculator(); - calculator.read(); + kalkulátor = new Kalkulátor(); + kalkulátor.read(); }); - it("the read method asks for two values using prompt and remembers them in object properties", function() { - assert.equal(calculator.a, 2); - assert.equal(calculator.b, 3); + it("funkce načti se zeptá na dvě hodnoty pomocí prompt a zapamatuje si je jako vlastnosti objektu", function() { + assert.equal(kalkulátor.a, 2); + assert.equal(kalkulátor.b, 3); }); - it("when 2 and 3 are entered, the sum is 5", function() { - assert.equal(calculator.sum(), 5); + it("když zadáme 2 a 3, součet je 5", function() { + assert.equal(kalkulátor.součet(), 5); }); - it("when 2 and 3 are entered, the product is 6", function() { - assert.equal(calculator.mul(), 6); + it("když zadáme 2 a 3, součin je 6", function() { + assert.equal(kalkulátor.součin(), 6); }); after(function() { diff --git a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/solution.md b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/solution.md index 86bb65416..8a7a577bb 100644 --- a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/solution.md +++ b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/solution.md @@ -1,23 +1,23 @@ ```js run demo -function Calculator() { +function Kalkulátor() { - this.read = function() { + this.načti = function() { this.a = +prompt('a?', 0); this.b = +prompt('b?', 0); }; - this.sum = function() { + this.součet = function() { return this.a + this.b; }; - this.mul = function() { + this.součin = function() { return this.a * this.b; }; } -let calculator = new Calculator(); -calculator.read(); +let kalkulátor = new Kalkulátor(); +kalkulátor.načti(); -alert( "Sum=" + calculator.sum() ); -alert( "Mul=" + calculator.mul() ); +alert( "Součet=" + kalkulátor.součet() ); +alert( "Součin=" + kalkulátor.součin() ); ``` diff --git a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/task.md b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/task.md index c862bec40..4ceaa62c2 100644 --- a/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/task.md +++ b/1-js/04-object-basics/06-constructor-new/2-calculator-constructor/task.md @@ -2,22 +2,22 @@ importance: 5 --- -# Create new Calculator +# Vytvořte nový Kalkulátor -Create a constructor function `Calculator` that creates objects with 3 methods: +Vytvořte konstruktor `Kalkulátor`, který bude vytvářet objekty se třemi metodami: -- `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. +- `načti()` se funkcí `prompt` zeptá na dvě hodnoty a uloží je jako vlastnosti objektu s názvy po řadě `a` a `b`. +- `součet()` vrátí součet těchto hodnot. +- `součin()` vrátí součin těchto hodnot. -For instance: +Například: ```js -let calculator = new Calculator(); -calculator.read(); +let kalkulátor = new Kalkulátor(); +kalkulátor.načti(); -alert( "Sum=" + calculator.sum() ); -alert( "Mul=" + calculator.mul() ); +alert( "Součet=" + kalkulátor.součet() ); +alert( "Součin=" + kalkulátor.součin() ); ``` [demo] diff --git a/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/solution.js b/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/solution.js index 585287c54..066d71ac6 100644 --- a/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/solution.js +++ b/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/solution.js @@ -1,8 +1,8 @@ -function Accumulator(startingValue) { - this.value = startingValue; +function Akumulátor(počátečníHodnota) { + this.hodnota = počátečníHodnota; - this.read = function() { - this.value += +prompt('How much to add?', 0); + this.načti = function() { + this.hodnota += +prompt('Kolik přičíst?', 0); }; -} +} \ No newline at end of file diff --git a/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/test.js b/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/test.js index a719cf45c..116b77da5 100644 --- a/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/test.js +++ b/1-js/04-object-basics/06-constructor-new/3-accumulator/_js.view/test.js @@ -1,4 +1,4 @@ -describe("Accumulator", function() { +describe("Akumulátor", function() { beforeEach(function() { sinon.stub(window, "prompt") @@ -8,23 +8,23 @@ describe("Accumulator", function() { prompt.restore(); }); - it("initial value is the argument of the constructor", function() { - let accumulator = new Accumulator(1); + it("úvodní hodnota je argument konstruktoru", function() { + let akumulátor = new Akumulátor(1); - assert.equal(accumulator.value, 1); + assert.equal(akumulátor.hodnota, 1); }); - it("after reading 0, the value is 1", function() { - let accumulator = new Accumulator(1); + it("po načtení 0 je hodnota 1", function() { + let akumulátor = new Akumulátor(1); prompt.returns("0"); - accumulator.read(); - assert.equal(accumulator.value, 1); + akumulátor.načti(); + assert.equal(akumulátor.hodnota, 1); }); - it("after reading 1, the value is 2", function() { - let accumulator = new Accumulator(1); + it("po načtení 1 je hodnota 2", function() { + let akumulátor = new Akumulátor(1); prompt.returns("1"); - accumulator.read(); - assert.equal(accumulator.value, 2); + akumulátor.načti(); + assert.equal(akumulátor.hodnota, 2); }); }); diff --git a/1-js/04-object-basics/06-constructor-new/3-accumulator/solution.md b/1-js/04-object-basics/06-constructor-new/3-accumulator/solution.md index eb145e79d..ddde781f9 100644 --- a/1-js/04-object-basics/06-constructor-new/3-accumulator/solution.md +++ b/1-js/04-object-basics/06-constructor-new/3-accumulator/solution.md @@ -1,17 +1,17 @@ ```js run demo -function Accumulator(startingValue) { - this.value = startingValue; +function Akumulátor(počátečníHodnota) { + this.hodnota = počátečníHodnota; - this.read = function() { - this.value += +prompt('How much to add?', 0); + this.načti = function() { + this.hodnota += +prompt('Kolik přičíst?', 0); }; } -let accumulator = new Accumulator(1); -accumulator.read(); -accumulator.read(); -alert(accumulator.value); +let akumulátor = new Akumulátor(1); +akumulátor.načti(); +akumulátor.načti(); +alert(akumulátor.hodnota); ``` diff --git a/1-js/04-object-basics/06-constructor-new/3-accumulator/task.md b/1-js/04-object-basics/06-constructor-new/3-accumulator/task.md index c2c44881e..5ef5469d6 100644 --- a/1-js/04-object-basics/06-constructor-new/3-accumulator/task.md +++ b/1-js/04-object-basics/06-constructor-new/3-accumulator/task.md @@ -2,26 +2,26 @@ importance: 5 --- -# Create new Accumulator +# Vytvořte nový Akumulátor -Create a constructor function `Accumulator(startingValue)`. +Vytvořte konstruktor `Akumulátor(počátečníHodnota)`. -Object that it creates should: +Objekt, který je tímto konstruktorem vytvořen, by měl: -- Store the "current value" in the property `value`. The starting value is set to the argument of the constructor `startingValue`. -- The `read()` method should use `prompt` to read a new number and add it to `value`. +- Ukládat „aktuální hodnotu“ do vlastnosti `hodnota`. Počáteční hodnota se nastaví na argument konstruktoru `počátečníHodnota`. +- Metoda `načti()` by se měla pomocí `prompt` zeptat na nové číslo a přičíst je k vlastnosti `hodnota`. -In other words, the `value` property is the sum of all user-entered values with the initial value `startingValue`. +Jinými slovy, vlastnost `hodnota` bude součet všech uživatelem zadaných hodnot a úvodní hodnoty `počátečníHodnota`. -Here's the demo of the code: +Zde je ukázka kódu: ```js -let accumulator = new Accumulator(1); // initial value 1 +let akumulátor = new Akumulátor(1); // počáteční hodnota 1 -accumulator.read(); // adds the user-entered value -accumulator.read(); // adds the user-entered value +akumulátor.načti(); // přičte uživatelem zadanou hodnotu +akumulátor.načti(); // přičte uživatelem zadanou hodnotu -alert(accumulator.value); // shows the sum of these values +alert(akumulátor.hodnota); // zobrazí součet těchto hodnot ``` [demo] diff --git a/1-js/04-object-basics/06-constructor-new/article.md b/1-js/04-object-basics/06-constructor-new/article.md index a335464f1..2f21faac7 100644 --- a/1-js/04-object-basics/06-constructor-new/article.md +++ b/1-js/04-object-basics/06-constructor-new/article.md @@ -1,231 +1,231 @@ -# Constructor, operator "new" +# Konstruktor, operátor „new“ -The regular `{...}` syntax allows us to create one object. But often we need to create many similar objects, like multiple users or menu items and so on. +Obvyklá syntaxe `{...}` nám umožňuje vytvořit jeden objekt. Často však potřebujeme vytvořit mnoho podobných objektů, např. více uživatelů, položek menu a podobně. -That can be done using constructor functions and the `"new"` operator. +To můžeme učinit pomocí konstruktorů a operátoru `"new"`. -## Constructor function +## Konstruktor -Constructor functions technically are regular functions. There are two conventions though: +Konstruktory jsou z technického hlediska obvyklé funkce. Platí pro ně však dvě konvence: -1. They are named with capital letter first. -2. They should be executed only with `"new"` operator. +1. Jejich název začíná velkým písmenem. +2. Měly by být volány jen pomocí operátoru `„new“`. -For instance: +Například: ```js run -function User(name) { - this.name = name; - this.isAdmin = false; +function Uživatel(jméno) { + this.jméno = jméno; + this.jeSprávce = false; } *!* -let user = new User("Jack"); +let uživatel = new Uživatel("Kuba"); */!* -alert(user.name); // Jack -alert(user.isAdmin); // false +alert(uživatel.jméno); // Kuba +alert(uživatel.jeSprávce); // false ``` -When a function is executed with `new`, it does the following steps: +Když je funkce volána pomocí `new`, provedou se následující kroky: -1. A new empty object is created and assigned to `this`. -2. The function body executes. Usually it modifies `this`, adds new properties to it. -3. The value of `this` is returned. +1. Vytvoří se nový prázdný objekt a přiřadí se do `this`. +2. Vykoná se tělo funkce. To obvykle modifikuje `this`, do něhož přidá nové vlastnosti. +3. Vrátí se hodnota `this`. -In other words, `new User(...)` does something like: +Jinými slovy, `new Uživatel(...)` udělá něco jako: ```js -function User(name) { +function Uživatel(jméno) { *!* - // this = {}; (implicitly) + // this = {}; (implicitně) */!* - // add properties to this - this.name = name; - this.isAdmin = false; + // přidá vlastnosti do this + this.jméno = jméno; + this.jeSprávce = false; *!* - // return this; (implicitly) + // return this; (implicitně) */!* } ``` -So `let user = new User("Jack")` gives the same result as: +Takže `let uživatel = new Uživatel("Kuba")` vydá stejný výsledek jako: ```js -let user = { - name: "Jack", - isAdmin: false +let uživatel = { + jméno: "Kuba", + jeSprávce: false }; ``` -Now if we want to create other users, we can call `new User("Ann")`, `new User("Alice")` and so on. Much shorter than using literals every time, and also easy to read. +Když nyní budeme chtít vytvořit jiné uživatele, můžeme volat `new Uživatel("Anna")`, `new Uživatel("Alice")` a tak dále. Je to mnohem kratší než pokaždé používat literály a je to i snadno čitelné. -That's the main purpose of constructors -- to implement reusable object creation code. +To je hlavní smysl konstruktorů -- implementovat opakovaně použitelný kód pro vytváření objektů. -Let's note once again -- technically, any function (except arrow functions, as they don't have `this`) can be used as a constructor. It can be run with `new`, and it will execute the algorithm above. The "capital letter first" is a common agreement, to make it clear that a function is to be run with `new`. +Znovu poznamenejme, že technicky může být libovolná funkce (s výjimkou šipkových funkcí, jelikož ty nemají `this`) použita jako konstruktor. Může být volána pomocí `new` a pak se vykoná výše uvedený algoritmus. „Velké první písmeno“ je obvyklá úmluva, aby bylo zřejmé, že funkce má být volána pomocí `new`. ````smart header="new function() { ... }" -If we have many lines of code all about creation of a single complex object, we can wrap them in an immediately called constructor function, like this: +Máme-li mnoho řádků kódu a všechny se týkají vytvoření jediného složitého objektu, můžeme je zapouzdřit do konstruktoru, který okamžitě zavoláme, například: ```js -// create a function and immediately call it with new -let user = new function() { - this.name = "John"; - this.isAdmin = false; - - // ...other code for user creation - // maybe complex logic and statements - // local variables etc +// vytvoříme funkci a okamžitě ji zavoláme pomocí new +let uživatel = new function() { + this.jméno = "Jan"; + this.jeSprávce = false; + + // ...další kód pro vytváření uživatele + // možná složitá logika a příkazy + // lokální proměnné atd. }; ``` -This constructor can't be called again, because it is not saved anywhere, just created and called. So this trick aims to encapsulate the code that constructs the single object, without future reuse. +Tento konstruktor nemůžeme volat znovu, protože není nikde uložen, bude pouze vytvořen a zavolán. Smyslem tohoto triku je tedy zapouzdřit kód, který vytvoří jediný objekt a dále se nepoužívá. ```` -## Constructor mode test: new.target +## Test režimu konstruktoru: new.target -```smart header="Advanced stuff" -The syntax from this section is rarely used, skip it unless you want to know everything. +```smart header="Pokročilá záležitost" +Syntaxe z této části se používá málokdy. Pokud nechcete znát opravdu všechno, můžete ji přeskočit. ``` -Inside a function, we can check whether it was called with `new` or without it, using a special `new.target` property. +Uvnitř funkce můžeme ověřit, zda byla volána pomocí `new` nebo bez něj, pomocí speciální vlastnosti `new.target`. -It is undefined for regular calls and equals the function if called with `new`: +Ta je při běžném volání `undefined`, ale pokud je funkce volána pomocí `new`, je rovna této funkci: ```js run -function User() { +function Uživatel() { alert(new.target); } -// without "new": +// bez „new“: *!* -User(); // undefined +Uživatel(); // undefined */!* -// with "new": +// s „new“: *!* -new User(); // function User { ... } +new Uživatel(); // function Uživatel { ... } */!* ``` -That can be used inside the function to know whether it was called with `new`, "in constructor mode", or without it, "in regular mode". +Můžeme ji použít uvnitř funkce, abychom se dozvěděli, zda byla volána „v režimu konstruktoru“ pomocí `new` nebo „v běžném režimu“ bez něj. -We can also make both `new` and regular calls to do the same, like this: +Můžeme také funkci přimět, aby při volání pomocí `new` a při běžném volání prováděla totéž, například takto: ```js run -function User(name) { - if (!new.target) { // if you run me without new - return new User(name); // ...I will add new for you +function Uživatel(jméno) { + if (!new.target) { // pokud mě spustíte bez new + return new Uživatel(jméno); // ...přidám new pro vás } - this.name = name; + this.jméno = jméno; } -let john = User("John"); // redirects call to new User -alert(john.name); // John +let jan = Uživatel("Jan"); // přesměruje volání na new Uživatel +alert(jan.jméno); // Jan ``` -This approach is sometimes used in libraries to make the syntax more flexible. So that people may call the function with or without `new`, and it still works. +Tento přístup se někdy používá v knihovnách, aby byla syntaxe flexibilnější. Lidé pak mohou volat funkci s `new` nebo bez něj a funkce pokaždé funguje. -Probably not a good thing to use everywhere though, because omitting `new` makes it a bit less obvious what's going on. With `new` we all know that the new object is being created. +Pravděpodobně však není dobré používat jej všude, protože bez uvedení `new` je trochu méně zřejmé, co se děje. Když je uvedeno `new`, všichni víme, že se vytváří nový objekt. -## Return from constructors +## Návrat z konstruktorů -Usually, constructors do not have a `return` statement. Their task is to write all necessary stuff into `this`, and it automatically becomes the result. +Konstruktory obvykle nemají příkaz `return`. Jejich úkolem je zapsat všechno potřebné do `this` a to se pak automaticky stane výsledkem. -But if there is a `return` statement, then the rule is simple: +Jestliže však je příkaz `return` přítomen, platí jednoduché pravidlo: -- If `return` is called with an object, then the object is returned instead of `this`. -- If `return` is called with a primitive, it's ignored. +- Je-li `return` volán s objektem, vrátí se namísto `this` tento objekt. +- Je-li `return` volán s primitivem, tento primitiv se ignoruje. -In other words, `return` with an object returns that object, in all other cases `this` is returned. +Jinými slovy, `return` s objektem vrátí onen objekt, ve všech ostatních případech se vrátí `this`. -For instance, here `return` overrides `this` by returning an object: +Například zde `return` přepisuje `this` vrácením objektu: ```js run -function BigUser() { +function VelkýUživatel() { - this.name = "John"; + this.jméno = "Jan"; - return { name: "Godzilla" }; // <-- returns this object + return { jméno: "Godzilla" }; // <-- vrátí tento objekt } -alert( new BigUser().name ); // Godzilla, got that object +alert( new VelkýUživatel().jméno ); // Godzilla, získali jsme onen objekt ``` -And here's an example with an empty `return` (or we could place a primitive after it, doesn't matter): +A zde je příklad s prázdným `return` (nebo za něj můžeme umístit primitiv, na tom nezáleží): ```js run -function SmallUser() { +function MalýUživatel() { - this.name = "John"; + this.jméno = "Jan"; - return; // <-- returns this + return; // <-- vrátí this } -alert( new SmallUser().name ); // John +alert( new MalýUživatel().jméno ); // Jan ``` -Usually constructors don't have a `return` statement. Here we mention the special behavior with returning objects mainly for the sake of completeness. +Konstruktory obvykle příkaz `return` neobsahují. Speciální chování s vracením objektů zde zmiňujeme zejména pro úplnost. ````smart header="Omitting parentheses" By the way, we can omit parentheses after `new`: ```js -let user = new User; // <-- no parentheses -// same as -let user = new User(); +let uživatel = new Uživatel; // <-- bez závorek +// totéž jako +let uživatel = new Uživatel(); ``` -Omitting parentheses here is not considered a "good style", but the syntax is permitted by specification. +Vypouštění závorek zde se nepovažuje za „dobrý styl“, ale specifikace tuto syntaxi povoluje. ```` -## Methods in constructor +## Metody v konstruktoru -Using constructor functions to create objects gives a great deal of flexibility. The constructor function may have parameters that define how to construct the object, and what to put in it. +Používání konstruktorů k vytváření objektů nám dává velké množství flexibility. Konstruktor může mít parametry, které definují, jak objekt zkonstruovat a co do něj uložit. -Of course, we can add to `this` not only properties, but methods as well. +Samozřejmě do `this` můžeme přidávat nejen vlastnosti, ale také metody. -For instance, `new User(name)` below creates an object with the given `name` and the method `sayHi`: +Například níže uvedené `new Uživatel(jméno)` vytvoří objekt se zadanou vlastností `jméno` a metodou `řekniAhoj`: ```js run -function User(name) { - this.name = name; +function Uživatel(jméno) { + this.jméno = jméno; - this.sayHi = function() { - alert( "My name is: " + this.name ); + this.řekniAhoj = function() { + alert( "Jmenuji se: " + this.jméno ); }; } *!* -let john = new User("John"); +let jan = new Uživatel("Jan"); -john.sayHi(); // My name is: John +jan.řekniAhoj(); // Jmenuji se: Jan */!* /* -john = { - name: "John", - sayHi: function() { ... } +jan = { + jméno: "Jan", + řekniAhoj: function() { ... } } */ ``` -To create complex objects, there's a more advanced syntax, [classes](info:classes), that we'll cover later. +K vytváření složitých objektů existuje i pokročilejší syntaxe -- [třídy](info:classes), kterou probereme později. -## Summary +## Shrnutí -- Constructor functions or, briefly, constructors, are regular functions, but there's a common agreement to name them with capital letter first. -- Constructor functions should only be called using `new`. Such a call implies a creation of empty `this` at the start and returning the populated one at the end. +- Konstruktory jsou obvyklé funkce, avšak panuje běžná úmluva, že jejich název by měl mít velké první písmeno. +- Konstruktory by měly být volány jedině pomocí `new`. Takové volání způsobí, že se na začátku vytvoří prázdné `this` a to se pak na konci vrátí naplněné. -We can use constructor functions to make multiple similar objects. +Konstruktory můžeme používat k vytváření více podobných objektů. -JavaScript provides constructor functions for many built-in language objects: like `Date` for dates, `Set` for sets and others that we plan to study. +JavaScript poskytuje konstruktory pro mnoho vestavěných jazykových objektů: např. `Date` pro data, `Set` pro množiny a jiné, které máme v plánu prostudovat. -```smart header="Objects, we'll be back!" -In this chapter we only cover the basics about objects and constructors. They are essential for learning more about data types and functions in the next chapters. +```smart header="Objekty, vrátíme se!" +V této kapitole probíráme ohledně objektů a konstruktorů jen základy, které jsou podstatné pro pochopení dalších věcí ohledně datových typů a funkcí v dalších kapitolách. -After we learn that, we return to objects and cover them in-depth in the chapters and . +Až se je naučíme, vrátíme se k objektům a probereme je do hloubky v kapitolách a . ```