Module 9 · this, Prototypes and Classes
Every Rule for this, and Every Piece of Class Syntax, One by One
Free with an accountReading
Kenji is building a shop app with a team. One teammate writes classes, another writes constructor functions, a third passes methods to timers. Every bug report this week says "this is undefined" or "this.price is NaN". The rules are not hard. There are just several of them, and each call form follows one.
Checking what this lesson needs for you…
What is inside Every Rule for this, and Every Piece of Class Syntax, One by One
- The method call
- The plain call
- call and apply
- bind
- new
- The arrow's lexical this
- Object.create and Object.getPrototypeOf
- Constructor functions and .prototype
- Class syntax: constructor and methods
- Class fields
- static
- Getters and setters
- extends and super
- Private fields with #
- instanceof
- class is sugar over prototypes
- Where the sugar leaks: methods are not bound
- Which this do I get?