Skip to content

Commit c1ec7eb

Browse files
committed
Solution
1 parent aaeacd8 commit c1ec7eb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/herbivoresAndCarnivores.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class Animal {
1010
}
1111

1212
class Herbivore extends Animal {
13-
hidden = false;
13+
constructor(name, hidden) {
14+
super(name);
15+
this.hidden = false;
16+
}
1417
hide() {
1518
this.hidden = true;
1619
}
@@ -23,9 +26,7 @@ class Carnivore extends Animal {
2326
}
2427

2528
if (target.health <= 0) {
26-
Animal.alive = Animal.alive.filter(
27-
(animal) => animal.name !== target.name,
28-
);
29+
Animal.alive = Animal.alive.filter((animal) => animal !== target);
2930
}
3031
}
3132
}

0 commit comments

Comments
 (0)