Loading video player…

Welcome to the Print Proof Cards

You’ll learn to choose, key by key, what a JavaScript object owns, computes, lists and lets you change.

Your project is Harbour Prints’ proof card export, a Python script you’ll port to JavaScript. Here’s a first taste. The Python Card stores its ID behind a read-only property:

Language: Python
import json

class Card:
    def __init__(self, title, price):
        self.title = title
        self.price = price
        self._id = "P-17"

    @property
    def id(self):
        return self._id

card = Card("Harbour", 12)
print(card.id)
report = {"id": card.id, "title": card.title}
print(json.dumps(report, separators=(",", ":")))

json.dumps() refuses the card itself, so the script builds its report by hand, and the report starts with the ID:

Language: Program Output
P-17
{"id":"P-17","title":"Harbour"}

The class ports line for line, the property as a getter. JSON.stringify() takes the card, so the port skips the hand-built report:

Language: JavaScript
class Card {
  constructor(title, price) {
    this.title = title;
    this.price = price;
    this._id = "P-17";
  }

  get id() {
    return this._id;
  }
}

const card = new Card("Harbour", 12);
console.log(card.id);
console.log(JSON.stringify(card));

card.id gives P-17, but the export has no id field:

Language: Program Output
P-17
{"title":"Harbour","price":12,"_id":"P-17"}

Exporting that ID on purpose is where this course is headed.

Harbour Prints sends each customer a proof card before a print run. In JavaScript, you set the card’s owned keys, getters, tags and locks yourself.

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

  • Separate a card’s own properties from its inherited defaults
  • Set a property’s flags on purpose
  • Choose between a live accessor and a snapshot when you copy an object
  • Tag a card with a symbol, and know which listings show it
  • Choose a shallow integrity level
  • Build Harbour Prints’ proof card export in JavaScript

In Python, you only need to know how attribute lookup uses an instance’s __dict__ and its class, how @property, __slots__ and copy.copy() behave, and read-only mappings such as MappingProxyType. In JavaScript, you only need to know classes with getters and setters, object literals, spread, Object.keys(), JSON.stringify(), delete and try/catch.

You’ll need a current version of Node installed. The examples use Node 26 and Python 3.15.

The course mixes short videos with text lessons and exercises. Every video has a summary below it. A quiz and a summary close the course.

Next up: Checking Who Owns a Property, a video that starts from the category every proof card shares.

Download

Sample Code (.zip)

12.1 KB
Download

Course Slides (.pdf)

932.8 KB

Become a Member to join the conversation.