JavaScript Flashcards
What is the purpose of variables?
a place to store data for the future
How do you declare a variable?
var “variable name” = value
How do you initialize (assign a value to) a variable?
with an equal sign
What characters are allowed in variable names?
letters, numbers(not first character), $, _
What does it mean to say that variable names are “case sensitive”?
letter casing creates unique variables
What is the purpose of a string?
basically text content
What is the purpose of a number?
to count and do math
What is the purpose of a boolean?
to show true/false, on/off
What does the = operator mean in JavaScript?
it means to assign value
it’s an assignment operator
How do you update the value of a variable?
“variable name” = new value
What is the difference between null and undefined?
null is null, undefined means no assigned value
Why is it a good habit to include “labels” when you log values to the browser console?
for ease of use later on
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
number operator
What is string concatenation?
combining strings together
What purpose(s) does the + plus operator serve in JavaScript?
addition or concatination
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adds left operand to right operand then assigns result to left operand
What are objects used for?
grouping data to represent an actual thing
What are object properties?
variables inside of an object
Describe object literal notation.
{ property: property name,
property name};
How do you remove a property from an object?
delete “object.property”
What are the two ways to get or update the value of a property?
dot notation or bracket notation
What are arrays used for?
making lists of data