-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 #5245
base: master
Are you sure you want to change the base?
Solution #5245
Conversation
@@ -4,7 +4,23 @@ | |||
* @return {number} | |||
*/ | |||
function calculateRentalCost(days) { | |||
// write code here | |||
const dailyRate = 40; |
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.
For const variables it is better to use this name format 'DAILY_RATE'
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.
Great job on implementing the calculateRentalCost
function! 🎉 Your code is well-structured, with clear variable names and a good use of constants. While the discount logic might need a review to ensure it aligns with the intended business rules, the core functionality is solid. Keep up the good work, and consider revisiting the discount application order to make sure it meets the requirements. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
if (days >= longTerm) { | ||
return rentAmount - longTermDiscount; | ||
} | ||
|
||
if (days >= shortTerm) { | ||
return rentAmount - shortTermDiscount; | ||
} |
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.
The logic for applying discounts might be incorrect. Currently, if days
is greater than or equal to longTerm
, the function will apply the long-term discount and return immediately, without checking if the short-term discount should also be applied. Ensure that the discount logic aligns with the intended business rules. If both discounts should not be applied simultaneously, consider revising the conditions.
No description provided.