Class Syntax and Constructors
In short: a class is a blueprint for building objects that share a
shape. Its constructor method runs once per new instance, setting up
that instance's own data with this.property = value. Every other
method defined in the class body is shared — all instances use the
exact same function, not a separate copy each. A class must always be
built with new; calling it as a plain function throws. Class bodies are
also always strict mode, whether or not you wrote "use strict"
anywhere.

Build two songs, and compare their data and methods
Each new Song(...) call runs the constructor fresh, giving that instance
its own properties — but all instances point at the exact same method:
a.describe === b.describe is true — describe is defined once, on the
class itself, and every instance shares that single function. a.title === b.title is false — this.title = title in the constructor gives
each instance its own, separate property, set from whatever was passed to
new Song(...). a.describe() reads this.title and this.seconds off
a specifically, printing "Blue Hour (214s)".
The trap: calling a class without new
A class constructor refuses to run as an ordinary function call — new
is mandatory, and JavaScript enforces it with a thrown error rather than
silently doing the wrong thing:
This throws TypeError: Class constructor Song cannot be invoked without 'new'. Regular functions can be called either way (fn() or new fn())
with different but valid behaviour for each; classes deliberately close
off the plain-call path entirely.
Quick practice
Given two instances of the same class, are their shared methods the exact same function?
Given class Song { constructor(title) { this.title = title; } }, are new Song("a").title and new Song("b").title the same value?
What happens when you call a class as a plain function, like Song("Blue Hour"), without new?
Is a class body strict mode, even without writing "use strict"?
What does a class's constructor method do?
🎯 Your turn
Given
class Song { constructor(title, seconds) { this.title = title; this.seconds = seconds; } describe() { return \${this.title} (${this.seconds}s)`; } }, explain what happens when you run const a = new Song("Blue Hour", 214); const b = new Song("Red Dawn", 198); console.log(a.describe === b.describe); console.log(a.title === b.title);, and why Song("x", 1)withoutnew` fails.
Write your explanation and submit it — there's no code to run here, just your reasoning.
