Skip to content
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 #4867

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Solution #4867

wants to merge 2 commits into from

Conversation

yurzxw
Copy link

@yurzxw yurzxw commented Oct 31, 2024

No description provided.

Copy link

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

Choose a reason for hiding this comment

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

Your implementation of calculateRentalCost is on the right track, but there are a few critical improvements needed to fully meet the task requirements. 🚀

  1. Use Constants for Magic Numbers: Replace literals like 40, 20, and 50 with named constants to make your code more readable and maintainable.

  2. Use const Instead of let: Since totalAmount is not reassigned, it should be declared with const to reflect its immutability.

  3. Simplify Conditional Logic: Consider using if statements with return to simplify your conditional logic and improve code clarity.

These changes will enhance the quality and maintainability of your code. Keep up the great work, and I'm confident you'll nail it with these adjustments! 💪

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

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

Copy link

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

Choose a reason for hiding this comment

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

Review Summary

Great job on implementing the calculateRentalCost function! 🎉 Your code meets the task requirements and constraints effectively. Here are a few points to consider for improvement:

  1. Descriptive Variable Names: The variables znyzhka and vznyzhka are not descriptive for English-speaking developers. Renaming them to smallDiscount and largeDiscount would enhance readability and maintainability.

  2. Use of Constants: Excellent use of constants for the discount values, which helps avoid hardcoding literals in expressions.

  3. Conditional Structure: While your use of else if statements is correct, consider using if with return to simplify conditions. This is a stylistic preference and not a strict requirement.

Overall, your code functions correctly according to the task description. The decision to approve is made to help you move forward with your learning. Please review the comments to improve your code. Remember, addressing these issues will enhance your coding skills and help you avoid similar problems in the future. Keep up the great work and continue learning! 🚀

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

Comment on lines +8 to +9
const znyzhka = 20;
const vznyzhka = 50;

Choose a reason for hiding this comment

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

The variable names znyzhka and vznyzhka are not descriptive in English. Consider renaming them to smallDiscount and largeDiscount for better readability.

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