-
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
#1-4Task. Artiom Uradau #975
base: master
Are you sure you want to change the base?
Conversation
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.
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.
It is necessary to observe indents between operators
@@ -69,7 +69,7 @@ function getStringFromTemplate(firstName, lastName) { | |||
* 'Hello, Chuck Norris!' => 'Chuck Norris' | |||
*/ | |||
function extractNameFromTemplate(value) { | |||
throw new Error('Not implemented'); | |||
return value.substring(7,value.length-1); |
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.
It is necessary to observe indents between operators
@@ -267,7 +270,9 @@ function isString(value) { | |||
* 'K♠' => 51 | |||
*/ | |||
function getCardId(value) { | |||
throw new Error('Not implemented'); | |||
let cards = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']; |
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.
Need to use "const"
@@ -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.
It is necessary to observe indents between operators
@@ -38,7 +38,7 @@ function getRectangleArea(width, height) { | |||
* 0 => 0 | |||
*/ | |||
function getCicleCircumference(radius) { | |||
throw new Error('Not implemented'); | |||
return radius*2*Math.PI; |
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.
It is necessary to observe indents between operators
@@ -102,7 +114,10 @@ function getArrayOfStrings(arr) { | |||
* [ false, 0, NaN, '', undefined ] => [ ] | |||
*/ | |||
function removeFalsyValues(arr) { | |||
throw new Error('Not implemented'); | |||
return arr.filter(elem => { |
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.
Here you can use simple option "filter(Boolean)"
@@ -116,7 +131,10 @@ function removeFalsyValues(arr) { | |||
* [ 'a', 'b', 'c', 'd', 'e', 'f', 'g' ] => [ 'A', 'B', 'C', 'D', 'E', 'F', 'G' ] | |||
*/ | |||
function getUpperCaseStrings(arr) { | |||
throw new Error('Not implemented'); | |||
let array = arr.map(elem => { |
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.
You can use return without variable.
Example: "arr.map(n => n.toUpperCase())"
@@ -200,7 +221,10 @@ function getTail(arr, n) { | |||
* +'30,31,32,33,34' | |||
*/ | |||
function toCsvText(arr) { | |||
throw new Error('Not implemented'); | |||
let array = arr.map(elem => { |
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.
Here you can use just "join('\n')"
@@ -371,7 +430,12 @@ function getFalsyValuesCount(arr) { | |||
* [ true, 0, 1, 'true' ], true => 1 | |||
*/ | |||
function findAllOccurences(arr, item) { | |||
throw new Error('Not implemented'); | |||
let numberOfRepeatedChars = 0; | |||
arr.filter(elem => { |
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.
You can solve this using "filter" and "length" without counter
@@ -353,7 +407,12 @@ function getItemsSum(arr) { | |||
* [ null, undefined, NaN, false, 0, '' ] => 6 | |||
*/ | |||
function getFalsyValuesCount(arr) { | |||
throw new Error('Not implemented'); | |||
let numberOfFalses = 0; | |||
arr.filter(elem => { |
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.
You can solve this using "filter" and "length" without counter
f49cd6a
to
9fa3ea8
Compare
https://travis-ci.com/github/uryadov1998/js-assignments/builds/182028664