← JavaScript learning path
JavaScript · Module 4 of 10

Loops and arrays

Store lists in arrays and repeat work with loops and array methods.

📖 Key ideas

  1. Arrays hold ordered lists: const marks = [70, 85, 90].
  2. Indexes start at 0; marks.length gives the count.
  3. for, for...of and while loops repeat work.
  4. push() adds to the end; pop() removes from the end.
  5. map(), filter(), reduce() and forEach() process arrays without manual loops.
💡 Real-life example: An array is a row of lockers numbered from 0; a loop visits each locker in turn.
push()Adds an item to the end
map()Makes a new array by transforming each item
filter()Keeps items that pass a test
lengthNumber of items in an array