Beginner Level
These test understanding of basic array methods and loops.
1. Find the sum of all elements in an array.
2. // Example: [2, 4, 6, 8] → 20
3. Find the maximum and minimum numbers in an array.
(Hint: Use [Link] / [Link] with the spread operator or loop)
4. Reverse an array without using reverse() method.
5. Count the number of even and odd elements in an array.
6. Check if a given element exists in an array or not.
7. Remove duplicates from an array.
(Hint: Use Set or filter logic)
8. Sort an array in ascending and descending order without using sort().
9. Find the average of all array elements.
10. Concatenate two arrays without using concat().
11. Convert an array of strings to uppercase.
12. ["apple", "banana", "mango"] → ["APPLE", "BANANA", "MANGO"]
Intermediate Level
These ques ons mix logic, algorithms, and array methods like map(), filter(), and reduce().
11. Return only the posi ve numbers from an array.
12. Find all numbers greater than 50 from an array.
13. Use map() to square each number in an array.
14. Use filter() and reduce() to find the sum of even numbers only.
15. Fla en a 2D array into a 1D array.
16. [[1,2],[3,4],[5,6]] → [1,2,3,4,5,6]
17. Find the frequency of each element in an array.
(Hint: Use an object as a frequency map)
18. Rotate an array by ‘n’ posi ons.
19. [1,2,3,4,5], n = 2 → [4,5,1,2,3]
20. Find the intersec on of two arrays.
21. Find the union of two arrays without duplicates.
22. Use reduce() to find the longest string in an array.
Advanced Level
These challenge logical thinking, algorithms, and ES6+ features.
21. Group array elements by type.
22. [1, "a", true, 2, "b", false] → { number: [1,2], string: ["a","b"], boolean: [true,false] }
23. Find all pairs in an array that sum to a given target.
24. [2,7,11,15], target=9 → [2,7]
25. Remove falsy values from an array.
(Falsy: 0, "", null, undefined, false, NaN)
26. Chunk an array into smaller arrays of size ‘n’.
27. [1,2,3,4,5,6], n=2 → [[1,2],[3,4],[5,6]]
28. Find the second largest number in an array.
29. Shuffle an array randomly.
30. Find missing numbers in a sequence array.
31. [1,2,4,6] → [3,5]
32. Implement a func on like [Link]() manually.
33. Find duplicate elements in an array.
34. Sort an array of objects by a property.
35. [{name:"A",age:25},{name:"B",age:20}] → sort by age
Would you like me to: