Object Test Flashcards
A____ is a value that has no properties or methods.
primitive value
A____ is data that has a primitive value.
primitive data type
JavaScript defines 5 types of primitive data types:
string number boolean null undefined
True or false? Primitive values are immutable
True
True or false? if x = 3.14, you can change the value of x. But you cannot change the value of 3.14.
True
A JavaScript object is a collection of_____
named values
The values of an object are written as:
name : valuepairs
The named values, in JavaScript objects, are called____
properties
Methods are___ that can be performed on objects.
actions
Anobject methodis an object property containing a___
function definition.
JavaScript objects are containers for named values, called
properties and methods.
There are 3 different ways to create new objects:
- Define and create a single object, using an object literal.
- Define and create a single object, with the keyword new.
- Define an object constructor, and then create objects of the constructed type.
What is the easiest way to create a javascript object?
Define and create a single object, using an object literal.
How do you define and create a single object, using an object literal.
varperson = {firstName:”John”, lastName:”Doe”, age:50, eyeColor:”blue”};
How do you define and create a single object, with the keyword new.
varperson =newObject();
person. firstName=”John”;
person. lastName=”Doe”;
person. age=50;
person. eyeColor=”blue”;