Javascript Classes Explained | Javascript Factory Functions | es6 private variables properties

Pubblicato il: 28 September 2020
sul canale di: Dave Gray
28,133
738

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

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.

▶ This video is part of the JavaScript Tutorials for Beginners Playlist found here:    • Javascript Tutorials for Beginners  

✅ Quick Concepts outline:
Javascript Classes:
(00:00) Intro
(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?

📚 Further Reading:
MDN Web Docs:
Classes: https://developer.mozilla.org/en-US/d...
Eloquent JavaScript Chapter 6:
https://eloquentjavascript.net/06_obj...

📺 More Beginner JS Videos:
freeCodeCamp:    • Learn JavaScript - Full Course for Be...  
Traversy Media:    • JavaScript Crash Course For Beginners  
The Net Ninja:    • Modern JavaScript Tutorial #1 - Intro...  

✅ Follow Me:
Twitter:   / yesdavidgray  
Reddit:   / daveoneleven  
Medium:   / davegray_86804  

#javascript #classes #explained


In questa pagina del sito puoi guardare il video online Javascript Classes Explained | Javascript Factory Functions | es6 private variables properties della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Dave Gray 28 September 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 28,133 volte e gli è piaciuto 738 spettatori. Buona visione!