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:
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:
21 C
Port it line by line, with a toString() method and a console.log() call:
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:
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()andtoString() - 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.