Javascript Classes Explained | Javascript Factory Functions | es6 private variables properties
Video Statistics and Information
Channel: Dave Gray
Views: 1,496
Rating: 4.8596492 out of 5
Keywords: javascript classes, javascript classes explained, javascript classes tutorial, javascript classes es6, javascript classes private variables, javascript classes private properties, javascript classes private fields, javascript factory functions, javascript factory functions explained, factory functions, factory functions explained
Id: 5fmifZZeJJ4
Channel Id: undefined
Length: 31min 18sec (1878 seconds)
Published: Mon Sep 28 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
In this video we explore the Javascript Class syntax introduced in ES6. We look at adding parameters, getters, setters, child classes with extends, the super keyword, public properties and private fields. We also look at how Factory Functions help us create private variables when we create objects.
✅ Quick Concepts outline:
Javascript Classes:
(0:11) Classes are "syntactic sugar" in JS
(0:45) Creating a simple class with a constructor
(0:50) Using the keyword this
(1:05) Adding a method to the class
(1:35) Classes are templates / blueprints for objects
(1:40) Using the new keyword to create the object
(1:55) Calling the object's method
(2:00) Adding parameters to the constructor
(3:20) Passing multiple parameters to the constructor
(4:35) Accessing properties with dot notation
(5:15) getters and setters
(6:52) A more readable getter and setter method
(8:15) An array property with a getter and setter
(10:20) A parent "super" class
(11:15) Creating a child class with extends
(11:35) The super keyword
(13:45) No need to create a parent object in order to create a child object from the classes
(16:15) A naming convention for private properties
(17:15) Good intentions but not enforced by the code
(17:45) Factory Functions
(19:50) Instantiating a pizza factory object
(20:20) Factory Functions solve the private properties problem
(22:00) New additions to JS allow public and private class fields
(28:40) How much support for public and private class fields?
If you enjoy this video, check out the ones that follow it in the playlist. I’ll continue to add more. Glad to answer your questions, too.
Javascript Classes Explained | Javascript Factory Functions: https://youtu.be/5fmifZZeJJ4