Data Types Flashcards

1
Q

What is an object?

A

{} data stored inside curly brackets. Objects contain properties and methods. Examples of objects in JavaScript : Arrays, functions

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

What is a primitive?

A

Primitives are the building blocks of JavaScript. Primitives are often described as limited data types. Examples: string, number, Boolean, undefined, null

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

What does undefined mean in JavaScript?

A

Undefined means that the value has not been set.

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

What does null mean in JavaScript?

A

Explicitly nothing.

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

How do you tell if something is an object in JavaScript?

A

If it is not a primitive (string, number, Boolean, undefined or null) then it is an object

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

{} ==={} what does this expression evaluate to? Why?

A

The expression returns false because although the objects contain the same data, they are separate objects. Essentially the expression could be rewritten as: is object1 === object2 ? No they are separate objects.

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

Var houseA = {};
houseA === houseA

What does this expression evaluate to and why?

A

The expression evaluates to true. This is because we set a variable to an object and compared the variable to to itself. We are essentially comparing one object to itself

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