Lists With Arrays

Martin Breuss 20 Lessons 4h 44m Updated basics js

How many crates on a packing list have names too long for a label, and which crates are they? How much does all the gear weigh? With one variable per item, your code would need a new variable every time the list grew. In this course, you’ll keep a whole list in one JavaScript array and write functions that loop over it to answer questions like these.

You’ll learn how to:

  • Build an array, read its .length, and add items with .push()
  • Visit every item in order with a for...of loop
  • Read and replace items by position, and choose between a value loop and a counting loop
  • Count the items that match a rule, and select them into a new list in their original order
  • Add up a total, find the largest or smallest item, and stop at the first match
  • Decide what each function should return for an empty list or when nothing matches

You’ll finish with a project: an expedition supply checker for a four-day hike. You’ll plan and build functions that count and select the supply names too long for a label, total the crate weights, and find the first weight over the carrying limit, then explain your choices in a mentor review.

This course is for beginners who have finished the earlier JavaScript Basics courses or can already write functions with loops, if blocks, and return. You’ll run short scripts with node in the VS Code terminal and practice in interactive coding exercises right on the site.

What’s Included:

  • 20 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Interactive Quiz to Check Your Progress
  • 8 Hands-On Coding Exercises
  • Q&A With JavaScript Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Related Learning Paths:

About Martin Breuss

Martin is Head of Content Strategy at RealJS. He came to programming from biology and has been teaching programming for more than ten years, as a coding mentor, code reviewer, curriculum developer, bootcamp instructor, and instructional designer.

» More about Martin

← Browse All Courses