Skip to content

#6Task.Maria Larchenko #299

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MariaLarchenko
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!

Comment on lines +97 to +100
function isTriangle(a, b, c) {
if (a + b > c && b + c > a && c + a > b) {
return true;
} else return false;
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 return (a + b > c) && (a + c > b) && (c + b > a) with the sam result
Please, improve logic for consistency
https://javascript.info/logical-operators

} else if (rigthB < rect1.left && bottomB < rect1.top) {
return false;
}
else return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually we don't need to use 'else' at the last statement (just return true)

Comment on lines +186 to +189
const diff = Math.pow((circle.center.x - point.x), 2) + Math.pow((circle.center.y - point.y), 2);
if (diff < Math.pow(circle.radius, 2)) {
return true;
} else return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://javascript.info/logical-operators
We can just return diff < Math.pow(circle.radius, 2)

@@ -166,7 +202,7 @@ function isInsideCircle(circle, point) {
* 'entente' => null
*/
function findFirstSingleChar(str) {
throw new Error('Not implemented');
return Array.from(str).filter(s => Array.from(str).filter(s2 => s2 == s).length == 1)[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

"operator === is always preferable
sometimes ''==' may cause an error
(check at console :
""0"" == 0
and ""0"" === 0)"

@@ -296,7 +353,31 @@ function getDigitalRoot(num) {
* '{[(<{[]}>)]}' = true
*/
function isBracketsBalanced(str) {
throw new Error('Not implemented');
if (str.length % 2 != 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

"operator !== is always preferable
sometimes ''!=' may cause an error
(check at console :
""0"" != 0
and ""0"" !== 0)"

const m2RowsNum = m2.length;
let result = [];

if (m1ColumnsNum != m2RowsNum) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

operator !== is always preferable

@vramaniuk vramaniuk marked this pull request as draft August 12, 2020 17:11
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.

3 participants