Arrays
Create, read, change, search, transform, sort, copy and flatten arrays: every array method you'll use daily, with the traps that cause real bugs.
An array is an ordered list of values kept under one name: a shopping list, the scores in a game, the rows of a table. Almost every real program works with lists, so arrays are the data structure you'll touch most often in JavaScript. This phase starts from [1, 2, 3] and goes all the way to the details interviewers ask about.
You'll learn how to create and read arrays (indexes, length, at, Array.from), how to change them (push, pop, splice and friends) and why it matters whether a method mutates the array or returns a new one. Then come the methods that make JavaScript arrays so pleasant: searching (find, includes, some), transforming (map, filter, reduce), sorting (and the famous [10, 1, 5].sort() trap), and how to choose between forEach, for...of and map.
Finally you'll unpack arrays with destructuring and spread, work with nested (2D) arrays and flat, and learn the difference between a shallow and a deep copy, the source of many "why did my other array change?" bugs. This phase uses functions and arrow functions from Phase 3 everywhere. Objects get their own phase next (Phase 6), and Hectal's /dsa course builds on these arrays for algorithms.
Practise this phase
Hands-on exercises: write the code, see your page live, and press Check to have it tested automatically.