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

Passed all tests #22

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

Conversation

yuriyivanenko
Copy link

No description provided.

Copy link

@stephenmckeon stephenmckeon left a comment

Choose a reason for hiding this comment

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

Nice job B-)

index.js Outdated
Comment on lines 12 to 17
if(destination > 42){
return (destination - 42) * 264
}
else{
return (42 - destination) * 264
}

Choose a reason for hiding this comment

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

Instead of duplicating the logic here, you can levage the the distanceFromHqInBlocks function:

Suggested change
if(destination > 42){
return (destination - 42) * 264
}
else{
return (42 - destination) * 264
}
distanceFromHqInBlocks(destination) * 264

index.js Outdated
Comment on lines 30 to 39
const distance = start > destination ? (start - destination) * 264 : (destination - start) * 264
if(distance <= 400 ){
return 0;
}else if(distance > 400 && distance < 2000){
return .02 * (distance-400);
}else if(distance > 2500){
return 'cannot travel that far'
}else if(distance > 2000){
return 25;
}

Choose a reason for hiding this comment

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

Suggested change
const distance = start > destination ? (start - destination) * 264 : (destination - start) * 264
if(distance <= 400 ){
return 0;
}else if(distance > 400 && distance < 2000){
return .02 * (distance-400);
}else if(distance > 2500){
return 'cannot travel that far'
}else if(distance > 2000){
return 25;
}
const distance = start > destination ? (start - destination) * 264 : (destination - start) * 264
if(distance <= 400 ){
return 0;
}else if(distance < 2000){
return .02 * (distance - 400);
}else if(distance > 2500){
return 'cannot travel that far'
}else if(distance > 2000){
return 25;
}

@yuriyivanenko
Copy link
Author

Cleaned up all functions and if blocks.

Copy link

@stephenmckeon stephenmckeon left a comment

Choose a reason for hiding this comment

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

Nice work!

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