Skip to content

Conversation

RomanTarasenko
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 concatenateStrings(value1, value2) {
throw new Error('Not implemented');
return value1+value2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, try to follow these rules https://javascript.info/coding-style
spaces between operators

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

Choose a reason for hiding this comment

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

Try to improve using Math.hypot

*/
function getParallelipidedDiagonal(a,b,c) {
throw new Error('Not implemented');
return Math.sqrt((a*a + b*b) + c*c)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Try to improve using Math.hypot

function findElement(arr, value) {
throw new Error('Not implemented');
if (arr.find((el) => el === value)) {
return arr.indexOf(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just this line will work as a solution

Comment on lines +78 to +84
let arrPos = [];
arr.map((el)=>{
if(el > 0){
arrPos.push(el)
}
});
return arrPos;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, use Array.prototype.filter method here

function removeFalsyValues(arr){
let newArr = [];
arr.map((el) =>{
if (Boolean(el) !== false){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant condition. Just if (el) { will work
Please, see https://javascript.info/logical-operators

Comment on lines +327 to +331
let newArr = arr.reverse();
if (arr.length > 3) {
newArr.length = 3;
}
return newArr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

If test cases had unsorted array, it woudn't work.
To prevent errors in case tests will reworked, please add sort method in place of reverse

let newArr = [];
if (arr.length){
arr.map((el) =>{
if (Boolean(el) === false){
Copy link
Collaborator

Choose a reason for hiding this comment

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

if (!el) will work
Please, see https://javascript.info/logical-operators

let newArr = [];
arr.map((el) =>{
let i = newArr.find(item => item === el);
if (i === undefined){
Copy link
Collaborator

Choose a reason for hiding this comment

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

!newArr.includes(el) will work. And remove line with find

@vramaniuk vramaniuk marked this pull request as draft August 21, 2020 19:11
@vramaniuk
Copy link
Collaborator

And try to resolve conflicting files. It's very significant in real project

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