AI Adoption - Drive Business Value and Organizational Impact
Get 35% Off CFI Certifications - Code CFI35
Overview
Syllabus
Classes are "syntactic sugar" in JS
Creating a simple class with a constructor
Using the keyword this
Adding a method to the class
Classes are templates / blueprints for objects
Using the new keyword to create the object
Calling the object's method
Adding parameters to the constructor
Passing multiple parameters to the constructor
Accessing properties with dot notation
getters and setters
A more readable getter and setter method
An array property with a getter and setter
A parent "super" class
Creating a child class with extends
The super keyword
No need to create a parent object in order to create a child object from the classes
A naming convention for private properties
Good intentions but not enforced by the code
Factory Functions
Instantiating a pizza factory object
Factory Functions solve the private properties problem
New additions to JS allow public and private class fields
How much support for public and private class fields?
Taught by
Dave Gray