ReactCHALLENGES
💻 Challenges🎁 Referral Program🐞 Report a Bug

© 2025 reactchallenges.com

Terms of ServicePrivacy PolicyContact

#25Arrays - The Must Have
30min

Overview

Practice and refresh the most essential array methods in JavaScript — from map, filter, and reduce to powerful combinations that make data handling in React effortless.

Requirements

  • Use only built-in JavaScript array methods (map, filter, find, some, every, reduce, sort, etc.).
  • Avoid using traditional for or while loops.
  • Return new arrays or values instead of mutating the original data.
  • Chain multiple methods when necessary to achieve more complex transformations.
  • Make sure to handle possible null or undefined values safely (e.g., using optional chaining or default values).

Notes

  • Each test focuses on a core array method you’ll commonly use when working with data in React components.
  • Pay attention to methods that return arrays (map, filter, sort) versus those that return a single value (find, some, every, reduce).
  • When sorting or reducing, ensure numeric operations handle missing ages or invalid data gracefully.
  • Revisit this challenge periodically — mastering these operations is key to writing concise, expressive React logic.

Tests

  1. returns array with name and gender
  2. filters deceased characters
  3. finds character named 'Lisa'
  4. filters adult male characters and maps basic info
  5. maps alive character names
  6. returns total number of characters
  7. checks if any character is under 18
  8. checks if all characters have gender
  9. sorts characters by ascending age
  10. sorts character names alphabetically
  11. calculates average age of alive characters as number with one decimal
  12. returns phrases that contains 'no' (case insensitive) with character name
Subscribe to StartBack