Javascript 4.5 Objects Flashcards

1
Q

Define “Objects”

A

An object is a collection of data and/or functionality. These usually consist of several variables and functions. ( Which are called properties and methods)

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

How do you access Object literals

A

dot notation and using square brackets

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

How do you set a value to an object

A

varName.name = ‘new value’;

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

In a ( for…. in ) loop how do we access a properties value

A

Using bracket notation preceded by the name of the object. The name within the bracket will be the var name declared within the for….in loop

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

What method returns an Array containing the property names or keys?

A

Object.keys( ); method

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

What method returns an Array containing the property values?

A

Object.values( ); method

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

How can we combine two objects with a special operator?

A

The spread operator ( … )

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