Javascript Flashcards
What is the purpose of variables?
to store data
How do you declare a variable?
var
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
letters, numbers, underscores, or dollar signs
What does it mean to say that variable names are “case sensitive”?
they are specific to how they are typed
What is the purpose of a string?
store and manipulate text
What is the purpose of a number?
to show value that would be number quantity
What is the purpose of a boolean?
to determine if something is true or false
What does the = operator mean in JavaScript?
putting in a value to something
How do you update the value of a variable?
just change the value
What is the difference between null and undefined?
null is an empty value, undefined means the variable has been declared but not defined
Why is it a good habit to include “labels” when you log values to the browser console?
point of reference
Give five examples of JavaScript primitives.
string numbers null undefined values
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combination of 2 or more string values
What purpose(s) does the + plus operator serve in JavaScript?
to add values or concatenate strings
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adds the value of the right operand to a variable and assigns the result to the variable
What are objects used for?
to group variables or functions
What are object properties?
variables inside objects
Describe object literal notation.
{properties: value}
How do you remove a property from an object?
delete
What are the two ways to get or update the value of a property?
dot notation bracket notation
What are arrays used for?
to be put in a list