Reference Types Flashcards
What are reference types?
Structures used to group data and functionality together
What is a reference value an instance of?
A specific reference type
Are there classes in JavaScript?
No. JacaScript does not support classss.
What is another name for reference types?
Object definitions
What is a constructor?
A simple function who’s purpose is to create an object.
What are objects an instance of?
A particular reference type.
What are two ways to create an instance of the Object type?
1. The new operator: var person = new Object();
2. Object literal notation: var person = {};
What is an expression context in ECMAScript?
A context in which a value (expression) is expected
How can you define an object so the Object constructor is never called?
An object defined via object literal notation never calls the Object constructor.
What type of data can an array hold?
Arrays can hold any type of data in each slot.
How are arrays sized?
Arrays are dynamically sized, automatically growing to accommodate any data that is added to them.
What two ways can arrays be created?
Using the array constructor: var colors = new Array();
Using array literal notation: var colors = [];
How can you initialize an Array if you know the amount of items that will be in the array?
var colors = new Array(20);
This will create an array with an initial length of 20.
When an array is created using array literal notation is the Array constructor called?
No.
What happens in this example: var colors = ["red", "blue"]; colors[2] = "green";
The array length is automatically expanded to be that index plus 1