50 JavaScript Array Practice Questions

🟢 Basic Level (1–15)

  1. Create an array of 5 numbers and print it.
  2. Create an array of 3 fruits and access the second element.
  3. Find the length of an array.
  4. Add a new element at the end using push().
  5. Remove the last element using pop().
  6. Add an element at the beginning using unshift().
  7. Remove the first element using shift().
  8. Create an array and print all elements using for loop.
  9. Print all elements using forEach().
  10. Replace the second element of an array.
  11. Check if an element exists using includes().
  12. Convert array to string using join().
  13. Reverse an array using reverse().
  14. Sort an array of numbers.
  15. Find index of a value using indexOf().

🟡 Intermediate Level (16–30)

  1. Create an array and double each value using map().
  2. Convert all strings to uppercase using map().
  3. Filter even numbers using filter().
  4. Filter numbers greater than 50.
  5. Find sum of array using reduce().
  6. Find maximum value using reduce().
  7. Count total elements using reduce().
  8. Remove duplicate values from an array.
  9. Merge two arrays.
  10. Find common elements between two arrays.
  11. Slice first 3 elements using slice().
  12. Remove 2 elements from index 1 using splice().
  13. Insert values using splice().
  14. Flatten a nested array (basic).
  15. Check if all elements are positive using every().

🟠 Advanced Level (31–50)

  1. Check if any number is greater than 100 using some().
  2. Create an array of objects (students with marks).
  3. Filter students who scored above 80.
  4. Use map() to extract student names.
  5. Calculate total marks of students using reduce().
  6. Sort students by marks (ascending).
  7. Sort students by marks (descending).
  8. Group numbers into even and odd arrays.
  9. Find second largest number in array.
  10. Rotate array to the right by 1 position.
  11. Count frequency of each element.
  12. Find missing number in sequence (1–10).
  13. Remove falsy values (false, 0, "", null, undefined).
  14. Convert array of strings to numbers.
  15. Find longest string in array.
  16. Chunk array into smaller arrays (size 2).
  17. Shuffle an array randomly.
  18. Find intersection of multiple arrays.
  19. Implement your own map() function.
  20. Build a mini Todo app using array methods.

🎯 Bonus Challenge

  • Build Student Result Dashboard
  • Create Shopping Cart System
  • Make Notes App using Arrays
  • Build Quiz App (Questions stored in array)