YoVDO

Javascript Classes Explained - Javascript Factory Functions - ES6 Private Variables Properties

Offered By: Dave Gray via YouTube

Tags

Javascript Courses Object-oriented programming Courses Inheritance Courses

Course Description

Overview

Explore JavaScript classes, factory functions, and ES6 private variables in this comprehensive 31-minute tutorial. Learn to create classes with constructors, add methods, use the 'this' keyword, and implement getters and setters. Discover how to work with parent and child classes using 'extends' and 'super' keywords. Dive into factory functions to solve private property challenges, and examine the latest additions to JavaScript for public and private class fields. Gain insights into naming conventions, object instantiation, and browser support for these features.

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

Related Courses

Introduction à la programmation orientée objet (en Java)
École Polytechnique Fédérale de Lausanne via Coursera
C++ For C Programmers, Part A
University of California, Santa Cruz via Coursera
Introduction to Programming for Musicians and Digital Artists
California Institute of the Arts via Coursera
Beginning Game Programming with C#
University of Colorado System via Coursera
Paradigms of Computer Programming
Université catholique de Louvain via edX