Skip to content

#1-4 Task. Roman Tarasenko - #845

Draft
RomanTarasenko wants to merge 6 commits into
ilya4321:masterfrom
RomanTarasenko:files-fixes
Draft

#1-4 Task. Roman Tarasenko#845
RomanTarasenko wants to merge 6 commits into
ilya4321:masterfrom
RomanTarasenko:files-fixes

Conversation

@RomanTarasenko

Copy link
Copy Markdown

@vramaniuk vramaniuk left a comment

Copy link
Copy Markdown
Collaborator

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 thread task/01-strings-tasks.js
*/
function concatenateStrings(value1, value2) {
throw new Error('Not implemented');
return value1+value2;

Copy link
Copy Markdown
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

Comment thread task/02-numbers-tasks.js
*/
function getDistanceBetweenPoints(x1, y1, x2, y2) {
throw new Error('Not implemented');
return Math.sqrt(((x2-x1)*(x2-x1)) +((y2-y1)*(y2-y1)));

Copy link
Copy Markdown
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

Comment thread task/02-numbers-tasks.js
*/
function getParallelipidedDiagonal(a,b,c) {
throw new Error('Not implemented');
return Math.sqrt((a*a + b*b) + c*c)

Copy link
Copy Markdown
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

Comment thread task/04-arrays-tasks.js
function findElement(arr, value) {
throw new Error('Not implemented');
if (arr.find((el) => el === value)) {
return arr.indexOf(value);

Copy link
Copy Markdown
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 thread task/04-arrays-tasks.js
Comment on lines +78 to +84
let arrPos = [];
arr.map((el)=>{
if(el > 0){
arrPos.push(el)
}
});
return arrPos;

Copy link
Copy Markdown
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

Comment thread task/04-arrays-tasks.js
function removeFalsyValues(arr){
let newArr = [];
arr.map((el) =>{
if (Boolean(el) !== false){

Copy link
Copy Markdown
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 thread task/04-arrays-tasks.js
Comment on lines +327 to +331
let newArr = arr.reverse();
if (arr.length > 3) {
newArr.length = 3;
}
return newArr;

Copy link
Copy Markdown
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

Comment thread task/04-arrays-tasks.js
let newArr = [];
if (arr.length){
arr.map((el) =>{
if (Boolean(el) === false){

Copy link
Copy Markdown
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

Comment thread task/04-arrays-tasks.js
let newArr = [];
arr.map((el) =>{
let i = newArr.find(item => item === el);
if (i === undefined){

Copy link
Copy Markdown
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
Copy Markdown
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