Class 31 Flashcards
What is an object?
Collection of variables (properties) and functions (methods)
How to create an object? (Use stopwatch as an example)
Using literal notation
let stopwatch = {}
How to create property and method of an object? (Use stopwatch as an example)
Using a dot notation
stopwatch.currentTime = 12
stopwatch.tellTime = function(time) {
console.log(“The current time is …}
How to make a lot of objects?
Use a constructor (or a class)
What is encapsulation?
The process of storing functions (methods) with their associated data (properties) - in one thing (object)
What is abstraction?
Hide details and show essentials
What is the keyword super for?
Call the constructor of its parents to access parents’ properties and methods (enable us to not have to repeat a lot of codes)
What is inheritance?
Make a class from another class for a hierarchy of classes that share a set of properties and methods