Skip to content

Task completed - #4482

Open
VladyslavL02 wants to merge 4 commits into
mate-academy:masterfrom
VladyslavL02:develop
Open

Task completed#4482
VladyslavL02 wants to merge 4 commits into
mate-academy:masterfrom
VladyslavL02:develop

Conversation

@VladyslavL02

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am requesting changes because a core requirement is missing and it blocks correct functionality. In src/herbivoresAndCarnivores.js, the Carnivore.bite method does not verify the target is a Herbivore; per the task, it should not work on another carnivore. Please add a type check like if (!(animal instanceof Herbivore)) return; before proceeding with the bite logic so carnivores cannot bite carnivores. Additionally, the CI is failing due to a lint error: there is an unexpected console statement at or around line 44 (ESLint no-console). Remove that console call or suppress it with // eslint-disable-next-line no-console if truly necessary. After adding the instanceof Herbivore guard and fixing the console lint issue, the feature should meet the requirements and allow the pipeline to proceed. Nice job handling the hidden state check; keep that logic alongside the new type guard.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example


class Carnivore extends Animal {
// write your code here
bite(animal) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bite method should check if the incoming animal is an instance of Herbivore before proceeding. According to the task: 'The method does not work if it is another carnivore'. Add a check for animal instanceof Herbivore.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation correctly meets all the task requirements. The Animal, Herbivore, and Carnivore classes are properly structured with the required properties and methods. The bite method correctly implements the dual condition checking that the target is a Herbivore and is not hidden, using a single if statement as expected. Dead animals are properly filtered from Animal.alive, and the hide method correctly sets the hidden property without toggling. Great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants