BeginnerCoder

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.

Want it another way?
Task

Add 40 to the array so the logged sum is 100.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.