Skip to content

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