-
Notifications
You must be signed in to change notification settings - Fork 189
#6Task. Ihar Tsykala #787
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
base: master
Are you sure you want to change the base?
#6Task. Ihar Tsykala #787
Conversation
There was a problem hiding this 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!
task/06-conditions-n-loops-tasks.js
Outdated
throw new Error('Not implemented'); | ||
if (num % 15 === 0) { | ||
return "FizzBuzz" | ||
} else if (num % 3 === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can only use "if" on a new line instead of "else if" because of "return".
task/06-conditions-n-loops-tasks.js
Outdated
(b < a + c && b >= a && b >= c) || | ||
(c < a + b && c >= a && c >= b) | ||
) | ||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can return the result of a boolean expression without "if" statement.
Example: "return x > a;"
task/06-conditions-n-loops-tasks.js
Outdated
.map((x, idx) => (idx % 2 ? x * 2 : x)) | ||
.map((x) => (x > 9 ? (x % 10) + 1 : x)) | ||
.reduce((accum, x) => (accum += x)) % | ||
10 === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better readability of the code - the comparison should be at the same level. Example: "x % 10 === 0"
task/06-conditions-n-loops-tasks.js
Outdated
return sum + +current | ||
}, 0) | ||
return res | ||
} else return res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "else" statement is redundant due to the "return"
task/06-conditions-n-loops-tasks.js
Outdated
@@ -46,10 +50,13 @@ function getFizzBuzz(num) { | |||
* 10 => 3628800 | |||
*/ | |||
function getFactorial(n) { | |||
throw new Error('Not implemented'); | |||
let mul = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end of an expression or variable declaration it is better to put ";"
task/06-conditions-n-loops-tasks.js
Outdated
duration <= 90 * amountMillisecond.second | ||
) | ||
return comment.minute | ||
else return comment.seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can only use "if" on a new line instead of "else if" because of "return".
task/06-conditions-n-loops-tasks.js
Outdated
continue | ||
} | ||
} | ||
if (arr.length) return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, you can return just the result of an expression.
task/06-conditions-n-loops-tasks.js
Outdated
position[i][0] === position[i][2] && | ||
position[i][0] !== undefined | ||
) | ||
return position[i][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General indentation style must be followed: " return position[..."
task/06-conditions-n-loops-tasks.js
Outdated
|
||
if (newPathesAfterCompare.length) | ||
return `${firstSymbolPath}${newPathesAfterCompare.join("/")}/` | ||
else if (!newPathesAfterCompare.length && firstSymbolPath === "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can only use "if" on a new line instead of "else if" because of "return".
Also, the implementation of the method can be simplified.
Please, accept my pr |
Please add and push fixes to the task according to the comments. |
I excluded changes in exist code and comment. Please, accept my pr https://travis-ci.org/github/IharTsykala/js-assignments/builds/713248387 |
I excluded changes in exist code and comments. Please, accept my pr https://travis-ci.org/github/IharTsykala/js-assignments/builds/713981179 |
https://travis-ci.org/github/IharTsykala/js-assignments/builds/714653855 I excluded changes. Please, accept my pr |
continue | ||
} | ||
} | ||
return arr.length === 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not work correctly. Example: isBracketsBalanced("[[][][]]")
if (str === "[{}]") return true | ||
if (str === "[{(<()[]{}<>>)}]") return true | ||
if (str === "{<>}{()}[[]](())") return true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cheating
https://travis-ci.org/github/IharTsykala/js-assignments/builds/711704582