Classes Flashcards

1
Q

What are classes in relation to JavaScript and Object Oriented Programing (OOP)?

A

Classes are a method for a developer to create similar objects quickly.

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

How are classes useful in object creation?

A

They allow us to reduce duplicate code and the time taken to debug a program.

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

What is one key difference in the syntax between objects and classes in JavaScript.

A

Classes contain a constructor method that allows the building of the initial key:value of the new object created by the Class.

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

By convention, how should we name our Classes in JavaScript?

A

They should be named in CamelCase but with a starting Capital letter.

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

What is a class instance in JavaScript?

A

An instance is an object, created using the Class, but with key:value pairs specific to that object

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

How do we create an instance of a class in JavaScript?

A

We use the ‘new’ keyword:

const objectName = new ClassName(‘parameter’)

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

Syntactically, what is different between methods in Objects and Classes?

A

You cannot use commas to separate methods in Classes

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