This course is about Maps, Sets and objects, and when to use each. Your project is to port Rosa’s season report for the Brook Street Community Garden.
Here’s a first taste. Plot 3 goes to the first person on the garden’s waiting list, which is kept in the order people asked. Here’s that step in Rosa’s Python script:
waiting = {214: "Dev Patel", 187: "Hannah Cole",
305: "Marek Nowak", 42: "June Harris"}
member = next(iter(waiting))
name = waiting[member]
print(f"Plot 3 goes to {name} (member {member})")
Dev Patel asked first, and Python gives him the plot:
Plot 3 goes to Dev Patel (member 214)
Here’s the JavaScript port, line for line, with the waiting list kept in an object:
const waiting = { 214: "Dev Patel", 187: "Hannah Cole",
305: "Marek Nowak", 42: "June Harris" };
const member = Object.keys(waiting)[0];
const name = waiting[member];
console.log(`Plot 3 goes to ${name} (member ${member})`);
It runs with no error and prints this:
Plot 3 goes to June Harris (member 42)
June Harris, member 42, gets the plot, where Python says Dev Patel, member 214, and she asked last. A line-for-line port can run without an error and quietly give a different answer, and this course shows you where, and what JavaScript does instead.
Rosa coordinates the garden’s nine plots. Its booking page runs on Node, so you’ll port her script.
By the end of this course, you’ll be able to:
- Choose between a Map and a plain object, and update and check a Map with
set(),delete()andhas()where Python assigns to a key, callspop()and usesin - Count and group without
Counterordefaultdict, with a Map andObject.groupBy() - Combine and compare Sets with
union(),intersection(),difference()andisSubsetOf()where Python uses|,&,-and<= - Build and deep-copy nested Maps and Sets with
getOrInsert()andstructuredClone(), where Python usesdefaultdict(set)andcopy.deepcopy() - Put Rosa’s whole season report together in JavaScript
You only need to know Python’s dicts, sets, Counter and defaultdict. In JavaScript, you only
need to know how to work with objects and arrays of objects, read an object’s keys with
Object.keys() and Object.entries(), use Sets and arrow functions, give a default with ??,
copy objects and arrays with structuredClone(), and sort with a compare function.
A few methods in this course are recent, such as Object.groupBy(), the Set methods like
union(), and getOrInsert(). The examples use Node 26 and Python 3.15.
The course mixes short videos and text lessons, with exercises where you write the code yourself. Every video has notes below it, so you can review without rewatching. A quiz and a summary close the course.
Next up: Keeping the Waiting List in Order, which starts from Rosa’s waiting list as a Python dict and ports it to JavaScript so that the right person gets the plot.