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 #4848

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

Solution #4848

wants to merge 2 commits into from

Conversation

andrushchenkoo
Copy link

No description provided.

Copy link

@SemenVodolazskij SemenVodolazskij left a comment

Choose a reason for hiding this comment

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

Все зрозуміло і чітко.

Copy link

@BudnikOleksii BudnikOleksii left a comment

Choose a reason for hiding this comment

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

Good work 👍
Just a few suggestions left

Comment on lines 7 to 11
const PRICE_PER_DAY = 40;
const LONG_TERM = 7;
const SHORT_TERM = 3;
const BIG_DISCOUNT = 50;
const SMALL_DISCOUNT = 20;

Choose a reason for hiding this comment

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

Move constants outside the function

const SMALL_DISCOUNT = 20;

if (days >= LONG_TERM) {
return days * PRICE_PER_DAY - BIG_DISCOUNT;

Choose a reason for hiding this comment

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

You do days * PRICE_PER_DAY 3 times, create a variable

Copy link

@BudnikOleksii BudnikOleksii left a comment

Choose a reason for hiding this comment

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

Good work 👍

function calculateRentalCost(days) {
// write code here
const PRICE = days * PRICE_PER_DAY;

Choose a reason for hiding this comment

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

Suggested change
const PRICE = days * PRICE_PER_DAY;
const currentPrice = days * PRICE_PER_DAY;

Variable names should be in camelCase

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.

4 participants