From Comprehensions to JavaScript Array Methods

Stephen Gruppetta 17 Lessons 3h 5m Updated intermediate js py

JavaScript has no comprehensions, and the ports that look closest give wrong answers, not errors. Port [r["name"] for r in runners if r["finish"] != "DNF"] in the order it reads, as runners.map((r) => r.name).filter((r) => r.finish !== "DNF"), and the list of finishers includes a runner who dropped out.

In this course, you’ll port a timing desk’s Python script, which cleans the runners’ chip reads and reports on the race, to JavaScript.

By the end of this course, you’ll be able to:

  • Turn comprehensions into filter() and map() chains, and build objects and sets from arrays
  • Unpack arrays and objects with destructuring, and spread them where Python uses * and **
  • Ask about a whole array with some() and every(), total it with reduce(), and find the fastest runner
  • Port the whole results cleaner to JavaScript

You’ll need Python’s comprehensions, map(), any(), all(), sum(), min() with key=, and * and ** unpacking, plus Node 26 and the JavaScript you’ve already used: arrays and objects, arrow functions, for...of loops, and array destructuring. The Python examples use Python 3.15.

The course mixes short videos and text lessons with exercises, a project that ports the whole results cleaner, and a quiz.

What’s Included:

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

Downloadable Resources:

Related Learning Paths:

About Stephen Gruppetta

Stephen obtained a PhD in physics and worked as a physicist in academia for over a decade before becoming a programming educator. He's constantly looking for simple ways to explain complex things.

» More about Stephen

← Browse All Courses