Array Challenges
Think you have a good handle on arrays? Why not try out these challenges then?
1 - First Element
Write a function to get the first element in an array. If you get that, try to find the last one.
Sample Data
Expected Output
First
We
Last
language
2 - Most Frequent Element
Calculate the most frequent element in an array.
Sample Data
Expected Output
fish ( 4 times )
3 - Largest and Smallest
Return the largest number in an array. Too easy? Try finding the largest numbers in multiple arrays. If that's still too easy, try doing the same with the smallest number.
Sample Data
Single Array
Multiple Arrays
Expected Output
Largest
85
[85, 86, 829, 4962]
Smallest
22
[22, 9, 147, 1337]
4 - Missing Number
There's a number missing from this unsorted array, what is it?
Sample Data
Expected Output
11
5 - "Arrays" in the DOM
Given the following HTML, change all <p>
tags to blue and italics.
Sample Data
Expected Output
6 - Sorting
Find two different ways to sort the given array so that the element with the lowest value is on the far left and the element with the highest value is on the far right.
Sample Data
Expected Output
Last updated