Skip to content

Conversation

KarinAnt
Copy link

No description provided.

Output: “Numbers: 2, Strings: 2”

Solution:
function Coun(arr){
Copy link
Contributor

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.

var arr = str.split(/[\s,-]+/);
var max = arr[0].length;
var b = arr[0];
for(let i = 1; i<arr.length; i++){
Copy link
Contributor

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

Solution:
function Array(arr, n){
var ar1 = [];
for(let i = 0; i < arr.length; i++){
Copy link
Contributor

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

if left rotations are performed on array [1, 2, 3, 4, 5], then the array would become [3, 4, 5, 1, 2].

Solution:
function Shi(arr, n){
Copy link
Contributor

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
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