JAVASCRIPT Flashcards
What is the purpose of variables?
the purpose of variables is to not lose track of the variable in your code
How do you declare a variable?
with the var keyword
How do you initialize (assign a value to) a variable?
with the = opertor
What characters are allowed in variable names?
$, _,
What does it mean to say that variable names are “case sensitive”?
if you have a variable with a capital S and lower case s they are different
What is the purpose of a string?
to have a number of letters to make up something
What is the purpose of a number?
the prupose of a number is to hold a numeric value.
What is the purpose of a boolean?
to determine true or false
What does the = operator mean in JavaScript?
it is the assignment operator
How do you update the value of a variable?
variable name = and then the value you want to give it
What is the difference between null and undefined?
null is done intentioanlly and undefined is not
Why is it a good habit to include “labels” when you log values to the browser console?
so you know what data is being output and you can keep track of what you are logging
Give five examples of JavaScript primitives.
string, number, boolean, undefined, null, array object
What data type is returned by an arithmetic operation?
numeric data type
What is string concatenation?
the joining of one strring and another string to make a whole string
What purpose(s) does the + plus operator serve in JavaScript?
it allows us to add strings or numerical values together
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adds and assigns new value to current value
What are objects used for?
a data type that allows you to store data in indivisual keys
What are object properties?
indivisual keys that hold a value
Describe object literal notation.
var hello = { }
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?
. notation and bracket notation
What are arrays used for?
arrays are used to store multiple values of data kind of like a shopping list