Skip to content

Commit 4850215

Browse files
committed
Addressed feedback
1 parent d9d172c commit 4850215

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/herbivoresAndCarnivores.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ class Carnivore extends Animal {
3434
prey.health -= 50;
3535

3636
if (prey.health <= 0) {
37-
const index = Animal.alive.indexOf(prey);
38-
39-
if (index > -1) {
40-
Animal.alive.splice(index, 1);
41-
}
37+
Animal.alive = Animal.alive.filter((animal) => animal.health > 0);
4238
}
4339
}
4440
}

0 commit comments

Comments
 (0)