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

task calculateRentalCost #4871

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Varvara00
Copy link

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 code meets the task requirements and is functionally correct! 🎉 The only minor issue is the variable naming convention, where TermDiscount should be renamed to termDiscount to follow JavaScript's camelCase convention. Additionally, consider simplifying your discount logic by removing redundant conditions. Keep up the great work, and happy coding! 😊

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

const basePriceOfDay = 40;
const longTerm = 7;
const longTermDiscount = 50;
const TermDiscount = 20;

Choose a reason for hiding this comment

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

The variable TermDiscount should be consistently named. Consider renaming it to shortTermDiscount to match the naming convention of longTermDiscount.

Comment on lines +20 to +21
} else if (days < longTerm) {
return basePrice - TermDiscount;

Choose a reason for hiding this comment

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

The condition days < longTerm is redundant here because it is already covered by the else block. Consider simplifying the logic by removing this else if block and directly applying the short-term discount for days between 3 and 6.

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