Class 31 Flashcards

1
Q

What is an object?

A

Collection of variables (properties) and functions (methods)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to create an object? (Use stopwatch as an example)

A

Using literal notation
let stopwatch = {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to create property and method of an object? (Use stopwatch as an example)

A

Using a dot notation
stopwatch.currentTime = 12
stopwatch.tellTime = function(time) {
console.log(“The current time is …}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to make a lot of objects?

A

Use a constructor (or a class)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is encapsulation?

A

The process of storing functions (methods) with their associated data (properties) - in one thing (object)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is abstraction?

A

Hide details and show essentials

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the keyword super for?

A

Call the constructor of its parents to access parents’ properties and methods (enable us to not have to repeat a lot of codes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is inheritance?

A

Make a class from another class for a hierarchy of classes that share a set of properties and methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly