Loading video player…

Welcome to the Gallery Readings

This course shows you how JavaScript turns values into text and numbers, and how to choose that yourself.

Your project is Mina’s museum temperature display, a Python script you’ll port to JavaScript. Each reading is a Celsius measurement with a printable label. Here’s a first taste. Mina’s Reading class stores a temperature, and __str__() returns its label:

Language: Python
class Reading:
    def __init__(self, celsius):
        self.celsius = celsius

    def __str__(self):
        return f"{self.celsius} C"

reading = Reading(21)
print(reading)

Printing a reading shows the label:

Language: Program Output
21 C

Port it line by line, with a toString() method and a console.log() call:

Language: JavaScript
class Reading {
  constructor(celsius) {
    this.celsius = celsius;
  }

  toString() {
    return `${this.celsius} C`;
  }
}

const reading = new Reading(21);
console.log(reading);

console.log() shows the object itself, its class name and its property:

Language: Program Output
Reading { celsius: 21 }

The label never appears. Asking for that label on purpose is what this course is about.

Mina runs a museum gallery’s temperature display. Her Python class keeps each reading’s number and label apart. The display is moving to JavaScript, where logging, formatting and arithmetic each work their own way.

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

  • Explain where a primitive value’s methods live, such as a string’s .toUpperCase()
  • Trace how JavaScript turns an object into text or a number with valueOf() and toString()
  • Read the specification’s conversion steps for a few values
  • Handle all three conversion hints with Symbol.toPrimitive
  • Port Mina’s gallery formatter to JavaScript

In Python, you only need to know the data model, where everything is an object and dunder methods such as __str__() and __float__() drive conversions. In JavaScript, you only need to know classes with constructor, this and toString(), typeof, ===, and converting with String(), Number() and Boolean().

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, and a quiz and a summary close the course.

Next up: Finding a Primitive’s Methods, a text lesson opening on a gallery label.

Download

Sample Code (.zip)

6.9 KB
Download

Course Slides (.pdf)

682.1 KB

00:00 Welcome to JavaScript’s Type System Under the Hood! You’ll see how JavaScript turns values into text and numbers, and how to choose that yourself. Your project is Mina’s museum temperature display, a Python script you’ll port to JavaScript.

00:15 Each reading is a Celsius measurement with a printable label. Here’s a first taste. Mina’s Reading class stores a temperature, and __str__() returns its label.

00:28 Printing a reading shows 21 C. Port it line by line, with a toString() method and a console.log() call. JavaScript shows the object itself: its class name and its property.

00:43 The label never appears.

00:47 Asking for that label on purpose is what this course is about. Mina runs a museum gallery’s temperature display. Her Python class keeps each reading’s number and label apart.

00:59 The display is moving to JavaScript, where logging, formatting and arithmetic each work their own way.

01:08 By the end, you’ll explain where a primitive’s methods live, trace how an object becomes text or a number, and read the spec’s conversion steps. You’ll handle all three conversion hints, and port Mina’s formatter.

01:23 You only need to know Python’s data model: everything is an object, and dunder methods drive conversions. In JavaScript, you need to know classes, typeof and the conversion functions.

01:36 The examples use Node 26 and Python 3.15.

01:41 Videos mix with text lessons and exercises, and every video has a summary. A quiz and a summary close the course. Next up: Finding a Primitive’s Methods, a text lesson opening on a gallery label.

Become a Member to join the conversation.