-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update array-and-strings.txt #1
base: master
Are you sure you want to change the base?
Conversation
array-and-strings.txt
Outdated
@@ -7,6 +7,17 @@ Input: [1, 4, ‘i am a string’, ‘456’] | |||
Output: “Numbers: 2, Strings: 2” | |||
|
|||
Solution: | |||
function Coun(arr){ |
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 name functions based on their purpose: getLongestWord, findNumbersAndSringsCount etc.
array-and-strings.txt
Outdated
var arr = str.split(/[\s,-]+/); | ||
var max = arr[0].length; | ||
var b = arr[0]; | ||
for(let i = 1; i<arr.length; 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.
Use forEach instead of for
array-and-strings.txt
Outdated
@@ -37,6 +60,15 @@ Input: "[1, 1, 2, -3, 0, 8, 4, 0], 9" | |||
Output: "[]" | |||
|
|||
Solution: | |||
function Array(arr, n){ | |||
var ar1 = []; | |||
for(let i = 0; i < arr.length; 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.
"filter" is more appropriate in this case
array-and-strings.txt
Outdated
|
||
Solution: | ||
function Shi(arr, n){ |
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 implement with one or no loops
end this exercises
No description provided.