LFZ JS Quiz Flashcards
What is the purpose of variables?
To store information
How do you declare a variable?
with the var keyword
How do you initialize (assign a value to) a variable?
with the assignment operator =
What characters are allowed in variable names?
$, _
What does it mean to say that variable names are “case sensitive”?
Capitalization matters
What is the purpose of a string?
to store an array of characters
What is the purpose of a number?
to store a number or float
What is the purpose of a boolean?
to store true or false
What does the = operator mean in JavaScript?
it is the assignment operator
How do you update the value of a variable?
assign the variable to another value with the assignment operator
What is the difference between null and undefined?
null is an empty object while undefined is nothing
Why is it a good habit to include “labels” when you log values to the browser console?
For clarity in debugging
Give five examples of JavaScript primitives.
string, number, boolean, undefined, null
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining two stings together into one
What purpose(s) does the + plus operator serve in JavaScript?
to add numbers or concatenate strings
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adds the result with itself
What are objects used for?
To group together a set of variables and functions
What are object properties?
the object’s variables
Describe object literal notation.
assign a var to an object by putting the object inside curly braces
How do you remove a property from an object?
using the delete keyword
What are the two ways to get or update the value of a property?
using dot notation or bracket notation
What are arrays used for?
To store data, mainly lists