EarniculumGet early accessJoin
← All courses

Working with Data in JavaScript

map, filter and reduce, objects that might be missing fields, JSON, sorting, and cleaning input you did not create.

beginnerEnglish281 min16 lessons
Earniculum CourseBuilt and published by EarniculumContains AdsThis course may include clearly labelled advertisements. Ad activity never affects rewards.ReviewedReviewed by Earniculum

About this course

The second programming course, and the one that turns loops into something you can read. Most loops you write are one of four shapes, and naming them makes code shorter and much clearer to the next person. It covers map, filter and reduce properly, including why reduce intimidates people and why it should not. Then objects: optional chaining, the difference between the two default operators that trips almost everyone, and shallow copies. Then real data: JSON and what it silently loses, the sort default that ruins numbers, and validating input where it enters your program rather than three functions later when it breaks. Every section has exercises that run in your browser and check your work, ending with a small reporting function that combines cleaning, filtering, reducing and sorting. It assumes you can already write a loop and a function.

What you will learn

  • Replace most loops with map, filter and reduce, and know when not to
  • Use reduce for sums, groupings and tallies without guessing
  • Read data that may be missing fields without throwing
  • Explain what JSON silently loses, and parse untrusted text safely
  • Sort numbers and objects correctly, including tie-breaks
  • Clean untrusted input at the boundary so the rest of your code can rely on it

Before you begin

  • Comfortable with variables, functions, conditionals and loops
  • JavaScript Foundations, or equivalent experience
  • A browser. Nothing to install
CREDENTIAL RECORD

What completion documents

Credential
Certificate of completion
Delivery
self study
Learning level
basic