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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
That's because the child constructor must call `super()`.
Isso acontece porque o construtor filho precisa chamar `super()`.

Here's the corrected code:
Aqui está o código corrigido:

```js run
class Animal {
Expand All @@ -21,7 +21,7 @@ class Rabbit extends Animal {
}

*!*
let rabbit = new Rabbit("White Rabbit"); // ok now
let rabbit = new Rabbit("White Rabbit"); // ok agora
*/!*
alert(rabbit.name); // White Rabbit
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ importance: 5

---

# Error creating an instance
# Erro ao criar uma instância

Here's the code with `Rabbit` extending `Animal`.
Aqui está o código com `Rabbit` estendendo `Animal`.

Unfortunately, `Rabbit` objects can't be created. What's wrong? Fix it.
Infelizmente, objetos de `Rabbit` não podem ser criados. O que está errado? Corrija.
```js run
class Animal {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
clock.start();


/* Your class should work like this: */
/* Sua classe deve funcionar assim: */

/*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ importance: 5

---

# Extended clock
# Relógio estendido

We've got a `Clock` class. As of now, it prints the time every second.
Temos uma classe `Clock`. Até agora, ela imprime a hora a cada segundo.


[js src="source.view/clock.js"]

Create a new class `ExtendedClock` that inherits from `Clock` and adds the parameter `precision` -- the number of `ms` between "ticks". Should be `1000` (1 second) by default.
Crie uma nova classe `ExtendedClock` que herda de `Clock` e adiciona o parâmetro `precision` -- o número de `ms` entre os "ticks". Deve ser `1000` (1 segundo) por padrão.

- Your code should be in the file `extended-clock.js`
- Don't modify the original `clock.js`. Extend it.
- Seu código deve estar no arquivo `extended-clock.js`
- Não modifique o `clock.js` original. Estenda-o.
Loading