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

#1-4Task. Artiom Uradau #975

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

Conversation

uryadov1998
Copy link

Copy link
Collaborator

@KostyaKov KostyaKov left a 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;
Copy link
Collaborator

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

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

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

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

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

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

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

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

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

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

@KostyaKov KostyaKov marked this pull request as draft August 31, 2020 10:01
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