-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
solution #1821
base: master
Are you sure you want to change the base?
solution #1821
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job.
A few moments to fix
src/herbivoresAndCarnivores.js
Outdated
@@ -1,15 +1,36 @@ | |||
'use strict'; | |||
|
|||
class Animal { | |||
// write your code here | |||
static alive = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#952 (comment)
You can add static property as in issue comment to avoid test fails
static alive = []; |
src/herbivoresAndCarnivores.js
Outdated
const index = Animal.alive.indexOf(animal); | ||
|
||
Animal.alive.splice(index, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change it to method filter and clear alive
array from animals with health <= 0
Move this logic to separated method in instance of Animal
class and use it here as method of Animal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done
No description provided.