← JavaScript learning pathJavaScript · Module 4 of 10
Loops and arrays
Store lists in arrays and repeat work with loops and array methods.
📖 Key ideas
- Arrays hold ordered lists: const marks = [70, 85, 90].
- Indexes start at 0; marks.length gives the count.
- for, for...of and while loops repeat work.
- push() adds to the end; pop() removes from the end.
- 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