Skip to content
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

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Task1 4 #1000

wants to merge 16 commits into from

Conversation

Sergey-Starushkin
Copy link

No description provided.

@vramaniuk vramaniuk self-requested a review September 10, 2020 13:12
@vramaniuk
Copy link
Collaborator

Now PR is clear. Ok
Plese implement tasks notes from our previous review #810

I'll mark the PR as "Draft", please click "ready for review" when it will be finished. Thank you!

@vramaniuk
Copy link
Collaborator

Please, privide the direct link to your task success travis build

@vramaniuk vramaniuk marked this pull request as draft September 10, 2020 13:13
@Sergey-Starushkin Sergey-Starushkin marked this pull request as ready for review September 10, 2020 17:08
@Sergey-Starushkin
Copy link
Author

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.

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

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+'!'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines +72 to +73
let value2 = value.replace("Hello, ",'')
return value2.replace("!",'')
Copy link
Collaborator

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

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

space around operator

Comment on lines +275 to +277
for (let i=0;i<arr.length;i++) {
i++
if(i<arr.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

spaces around operators

Comment on lines +324 to +325
let reversed=arr.reverse()
return reversed.slice(0,3)
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 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

Comment on lines +343 to +351
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
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 find solution with no loops
Use filter method for positives, and return its length

Comment on lines +388 to +389
for (let i = 0; i<arr.length;i++){
sum+=arr[i]
Copy link
Collaborator

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);
Copy link
Collaborator

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

@vramaniuk vramaniuk marked this pull request as draft September 11, 2020 08:24
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.

3 participants