-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Develop #5006
base: master
Are you sure you want to change the base?
Develop #5006
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.
Great job on implementing the calculateRentalCost
function! 🎉 The logic is solid, and it meets the task requirements effectively. Just a couple of minor suggestions: consider renaming BASEPRISE
to BASEPRICE
and SELL
to something more descriptive like DISCOUNT_AMOUNT
for better clarity. Keep up the excellent work! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
* @return {number} | ||
*/ | ||
const LONG_TERM = 3; | ||
const BASEPRISE = 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.
The variable name BASEPRISE
seems to be a typo. It should likely be BASEPRICE
to correctly represent the base price of the rental.
@@ -6,5 +1,22 @@ | |||
const LONG_TERM = 3; | |||
const BASEPRISE = 40; | |||
const SELL = 20; |
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 variable name SELL
is not clear in this context. It might be intended to represent a discount or reduction, so a more descriptive name like DISCOUNT_AMOUNT
would be more appropriate.
function calculateRentalCost(days) { | ||
// write code here | ||
const fullCost = days * BASEPRISE; |
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 calculation of fullCost
is correct, but ensure that the variable BASEPRISE
is correctly named as BASEPRICE
.
const fullCost = days * BASEPRISE; | ||
|
||
if (days >= GOOD_DAYS) { | ||
return fullCost - DISCOUNT; |
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 here is correct for applying a discount for rentals longer than GOOD_DAYS
. Ensure that the discount logic is clearly documented or explained.
} | ||
|
||
if (days >= LONG_TERM) { | ||
return fullCost - SELL; |
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 here applies a discount for rentals longer than LONG_TERM
. Ensure that the variable SELL
is correctly named to reflect its purpose as a discount.
No description provided.