- Demo – In-session live coding: plain-object motivation,
Commentclass, methods, flagged comments, then Errors / Web Components as “real world” context. index.js = worksheet; index-solution.js = reference. README.
Start VERY simple. Just a class that has few fields, no methods. Explain the diff from object to class. Explain instance etc. When they get that move on to class methods. Only teach extends if they really are on top of things otherwise just get them comfortable with classes :) if you can repeat a bit of promise, maybe when working with class that would be great.
- Constructor
- Instance
- Methods (instance + static)
- Code inspiration
- Code inspiration — static methods (Promise as "you already use this")
- Exercise
this- Refers to the instance of the class. Do go into too much detail and edge cases. Avoid mentioning
bind,apply, etc unless you find it super important, the trainees will just forget it anyway!
- Refers to the instance of the class. Do go into too much detail and edge cases. Avoid mentioning
- Exercise
- Extend (Only if time!)
- Code inspiration (
Error,ValidationError, Web Components sketch — matches demo Part 4)
- Code inspiration (
See the separate Exercises document.
See the separate Code inspiration document.