JAVASCRIPT Flashcards
What is the purpose of variables?
to store or remmeber information
How to declare a variable
var and name of variable
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
$, any character, _, a number as long as its not in the beginning
What does it mean to say that variable names are “case sensitive”?
that capital letters affect it
How do you update the value of a variable?
re declare them
What is the difference between null and undefined?
null is put there by a programmer undefined is there in the absence of anything
Why is it a good habit to include “labels” when you log values to the browser console?
for readability
What data type is returned by an arithmetic operation?
number
What purpose(s) does the + plus operator serve in JavaScript?
concatination and addition
What data type is returned by comparing two values (, ===, etc)?
boolean type
What does the += “plus-equals” operator do?
adds the value to the current value and reasign the variable
What are objects used for?
to combine like information
What are object properties?
allow you to store information
Describe object literal notation.
var object ={}
How do you remove a property from an object?
delete operator
What are the two ways to get or update the value of a property?
. or []
What are arrays used for?
store a list of items
Describe array literal notation.
var array =[];
How are arrays different from “plain” objects?
objects have properties arrays don’t
What number represents the first index of an array?
0
What is the length property of an array?
the number of values in array
How do you calculate the last index of an array?
length -1
What is a function in JavaScript?
an set of instructions