javascript-objects Flashcards

1
Q

What are objects used for?

A

Objects are a standalone entity with a property and type. They group together functions and variables. They allow for storing multiple data types which is something that variables can’t do. You can have two variables with the same name as long as they are in different scopes

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

What are object properties?

A

Object properties are variables that live in an object. They are what give us info about the object.

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

Describe object literal notation.

A

It’s the most common/easiest way to define an object. The object is in a set of curly braces. That object is stored in a variable. Separate each key from its value with a colon. Separate properties and methods by commas.

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

How do you remove a property from an object?

A

by using the delete operator

delete cat.type

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

What are the two ways to get or update the value of a property?

A

bracket notation vs dot notation

pet[‘type’} vs pet.type

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