Lesson
Filter
filter walks the lots and keeps the ones that pass a test. It returns a new list. The original map is unchanged.
const lots = [
{ tag: "Ada", claimed: true },
{ tag: "empty", claimed: false },
];
const claimed = lots.filter((lot) => lot.claimed);
// claimed is [{ tag: "Ada", claimed: true }]The test must return true or false. lot.claimed is already that.
const nums = [1, 2, 3, 4]; const evens = nums.filter((n) => n % 2 === 0); // evens is [2, 4]
The census does this: filter to claimed lots, then map those houses onto the canvas.