Porting Python's Defaults and match Statements to JavaScript (Fast Track)

Stephen Gruppetta 15 Lessons 2h 19m Updated intermediate js py

Port Python’s r["rooms"] or [DEFAULT_ROOM] as r.rooms || [DEFAULT_ROOM], and a booking with no room ticked gets no room and a $0.00 fee. Python’s or and None checks map onto two JavaScript operators that disagree about 0, "", and empty lists.

In this course, you’ll port a community center’s Python booking confirmations. This is the Fast Track version, for learners with more Python experience: it covers the same ground as the standard course, faster, in shorter lessons.

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

  • Pick values with || and &&, and choose between || and ?? for a default
  • Fill in missing values with ??=, ||=, and &&=
  • Port a match statement with guards or patterns
  • Call a function only when there is one with ?.()
  • Port the whole booking confirmations script

You’ll need Python’s or, and, and match, plus Node 26 and JavaScript objects, Maps, arrow functions, ??, ?., the conditional operator, and switch. The Python examples use Python 3.15.

The course mixes short videos and text lessons with exercises, a project, and a quiz.

What’s Included:

  • 15 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Interactive Quiz to Check Your Progress
  • 5 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