#1-4 Task. Roman Tarasenko - #845
Conversation
vramaniuk
left a comment
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Just this line will work as a solution
| let arrPos = []; | ||
| arr.map((el)=>{ | ||
| if(el > 0){ | ||
| arrPos.push(el) | ||
| } | ||
| }); | ||
| return arrPos; |
There was a problem hiding this comment.
Please, use Array.prototype.filter method here
| function removeFalsyValues(arr){ | ||
| let newArr = []; | ||
| arr.map((el) =>{ | ||
| if (Boolean(el) !== false){ |
There was a problem hiding this comment.
Redundant condition. Just if (el) { will work
Please, see https://javascript.info/logical-operators
| let newArr = arr.reverse(); | ||
| if (arr.length > 3) { | ||
| newArr.length = 3; | ||
| } | ||
| return newArr; |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
!newArr.includes(el) will work. And remove line with find
|
And try to resolve conflicting files. It's very significant in real project |
https://travis-ci.org/github/RomanTarasenko/js-assignments/builds/714484766