Lesson 5 — Arrays
Arrays
An array is an ordered list of values in square brackets. push() adds to the end, and methods like forEach and map walk through every item.
Why it matters: arrays hold collections — prices, users, messages — that you loop over to build almost any feature.
Tip: indexes start at 0, so nums[0] is the first element and nums.length is how many there are.
Add 40 and log the sum.
Ready for more? These paid resources pick up where this lesson leaves off.
Project-based JavaScript Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →Hand-picked JavaScript Foundations books to master the fundamentals offline.
See on Amazon →Some links on this page are affiliate links: we may earn a commission at no extra cost to you. We only recommend tools we believe are genuinely useful.