JavaScript Arrays Homework Tasks
//I have used the custom build Telerik Software Academy "js-console" for better output visibility//
- Write a script that allocates array of 20 integers and initializes each element by its index multiplied by 5. Print the obtained array on the console.
- Write a script that compares two char arrays lexicographically (letter by letter).
- Write a script that finds the maximal sequence of equal elements in an array. Example: {2, 1, 1, 2, 3, 3, 2, 2, 2, 1} --> {2, 2, 2}
- Write a script that finds the maximal increasing sequence in an array. Example: �{3, 2, 3, 4, 2, 2, 4} --> {2, 3, 4}
- Sorting an array means to arrange its elements in increasing order. Write a script to sort an array. Use the "selection sort" algorithm: Find the smallest element, move it at the first position, find the smallest from the rest, move it at the second position, etc.�Hint: Use a second array
- Write a program that finds the most frequent number in an array. Example: {4, 1, 1, 4, 2, 3, 4, 4, 1, 2, 4, 9, 3} --> 4 (5 times)
- *Write a program that finds the index of given element in a sorted array of integers by using the binary search algorithm (find it in Wikipedia)