-
Notifications
You must be signed in to change notification settings - Fork 192
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
Task1 4 #1000
base: master
Are you sure you want to change the base?
Task1 4 #1000
Conversation
Now PR is clear. Ok I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you! |
Please, privide the direct link to your task success travis build |
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.
lots of formatting issues:
lots of ; and missing;
I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you!
@@ -22,7 +22,7 @@ | |||
* '', 'bb' => 'bb' | |||
*/ | |||
function concatenateStrings(value1, value2) { | |||
throw new Error('Not implemented'); | |||
return value1+value2 |
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.
space around operator
Please, try to follow these rules https://javascript.info/coding-style
@@ -55,7 +55,7 @@ function getStringLength(value) { | |||
* 'Chuck','Norris' => 'Hello, Chuck Norris!' | |||
*/ | |||
function getStringFromTemplate(firstName, lastName) { | |||
throw new Error('Not implemented'); | |||
return 'Hello, '+ firstName+' '+lastName+'!' |
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.
let value2 = value.replace("Hello, ",'') | ||
return value2.replace("!",'') |
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.
redundant variable declarations, you just can do return value.replace(...).replace(...)
@@ -22,7 +22,7 @@ | |||
* 5, 5 => 25 | |||
*/ | |||
function getRectangleArea(width, height) { | |||
throw new Error('Not implemented'); | |||
return width*height |
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.
space around operator
@@ -38,7 +38,7 @@ function getRectangleArea(width, height) { | |||
* 0 => 0 | |||
*/ | |||
function getCicleCircumference(radius) { | |||
throw new Error('Not implemented'); | |||
return (Math.PI * radius)*2; |
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.
space around operator
for (let i=0;i<arr.length;i++) { | ||
i++ | ||
if(i<arr.length) { |
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.
spaces around operators
let reversed=arr.reverse() | ||
return reversed.slice(0,3) |
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.
If test cases weren't sorted , this solution wouldn't work.
Add sort method
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
spaces
let result=0 | ||
for (let i = 0; i<arr.length;i++){ | ||
if (typeof (arr[i])==="string"){ | ||
i++ | ||
}else if (arr[i]>0){ | ||
result+=1 | ||
} | ||
} | ||
return result |
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.
Please, try to find solution with no loops
Use filter method for positives, and return its length
for (let i = 0; i<arr.length;i++){ | ||
sum+=arr[i] |
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.
spaces
@@ -353,7 +404,7 @@ function getItemsSum(arr) { | |||
* [ null, undefined, NaN, false, 0, '' ] => 6 | |||
*/ | |||
function getFalsyValuesCount(arr) { | |||
throw new Error('Not implemented'); | |||
return arr.reduce((element1, element2) => element1 + (Boolean(element2) === false), 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.
return arr.reduce((element1, element2) => element1 + (!Boolean(element2)), 0);
this works
Please, see https://javascript.info/logical-operators
No description provided.