Skip to content

Conversation

StYaroslav
Copy link

Copy link
Collaborator

@vramaniuk vramaniuk left a comment

Choose a reason for hiding this comment

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

I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you!

*/
function getDistanceBetweenPoints(x1, y1, x2, y2) {
throw new Error('Not implemented');
return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, improve code using Math.hypot

Comment on lines 92 to 93
let result = -b / a;
return result === 0 ? 0 : result;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can just return -b / a because
-0 === 0 (true)

Copy link
Author

Choose a reason for hiding this comment

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

We can just return -b / a because
-0 === 0 (true)

Yes, I have checked this when I was doing the task, but when I return -b / a it says that 0 was expected but actually got -0 and test fails.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But we have successful tracis build for such solution here:
#928

https://travis-ci.org/github/AleshaKolesnikov/js-assignments/builds/719550067
Please, try to find differences.
May be node versions, travis.yml

Comment on lines 116 to 117
let firstVectorMagnitude = Math.sqrt((Math.pow(x1, 2)) + Math.pow(y1, 2));
let secondVectorMagnitude = Math.sqrt((Math.pow(x2, 2)) + Math.pow(y2, 2));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, improve code using Math.hypot

Comment on lines 134 to 138
let result = 0;
for(let i = 0; i < value.toString().length; i++){
result = value % 10;
}
return result;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can solve this task without loops.
(last digit of any decimal number is remainder of division by 10)

@vramaniuk vramaniuk marked this pull request as draft August 20, 2020 11:38
@StYaroslav StYaroslav force-pushed the tasks-1-4 branch 4 times, most recently from 5ad9b2a to 0f69438 Compare August 25, 2020 18:32
@StYaroslav
Copy link
Author

@StYaroslav StYaroslav marked this pull request as ready for review September 16, 2020 10:47
@vramaniuk
Copy link
Collaborator

Closing the PR as accepted! Thanks!

@vramaniuk vramaniuk closed this Sep 16, 2020
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