JavaScript classes for the Python Programmer
summary
Compares JavaScript and Python class semantics with concrete examples: this vs self and prototype lookup instead of type lookup, constructor vs initializer where JS constructors run in layered order and public fields are set before body runs, causing the subclass factor example to produce 2 instead of 5. Shows fixes: use Function.prototype.bind or call, reference this.constructor.staticName, and use static initializers (ES2015 classes) to build working enums and predictable subclassing.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:05Explicit classes
- 2:54Properties attributes
- 4:36Constructor
- 6:38Static methods
- 7:34Subclasses
- 8:49Initializers
- 10:04New
- 10:31Class Syntax
- 11:02subclassing
- 11:49static properties
- 12:13subclass overrides
- 12:41factor
- 14:31Static Constructor
- 15:20Static Initializers
- 17:27Static Initializers Example
- 18:24Questions
related talks
43mJavaScript for Python Developers
36mThe Afterlife: Languages after JavaScript
47mYou might not need JavaScript classes
40mYou might not need JavaScript classes
54mPatterns for Programming in JavaScript
28mJavaScript inheritance: beyond the basics
19mObjects and classes in Python (and JavaScript)
39mJavascript for people who didn't learn Javascript
