Data Types Flashcards
What is an object?
{} data stored inside curly brackets. Objects contain properties and methods. Examples of objects in JavaScript : Arrays, functions
What is a primitive?
Primitives are the building blocks of JavaScript. Primitives are often described as limited data types. Examples: string, number, Boolean, undefined, null
What does undefined mean in JavaScript?
Undefined means that the value has not been set.
What does null mean in JavaScript?
Explicitly nothing.
How do you tell if something is an object in JavaScript?
If it is not a primitive (string, number, Boolean, undefined or null) then it is an object
{} ==={} what does this expression evaluate to? Why?
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.
Var houseA = {};
houseA === houseA
What does this expression evaluate to and why?
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