JavaScript Flashcards
what is the purpose of variables?
to store data
how do you declare a variable?
with the keyword var
how do you initialize a variable?
with the assignment operator
what characters are allowed in variable names?
letters, numbers, _, $. can NOT start with number
what does it mean to say that variable names are “case sensitive”
name must be exact including if a letter is uppercase or lowercase
what is the purpose of a string?
storing and manipulating text.
what is the purpose of a number?
to perform calculations
what is the purpose of a boolean?
to determine what is run in JS
what does the = operator mean in JavaScript?
assignment operator
how do you update the value of a variable?
reassign using assignment operator
what is the difference between null and undefined?
undefined is not defined.
null was purposely set to null
why is it a good habit to include labels when you log values to the console?
to keep track of what you’re logging.
give 5 examples of JavaScript primitives
string, number, boolean, undefined, null
what data type is returned by an arithmetic operation
a number
what is a string concatenation
joining two or more strings.
what purpose(s) does the + plus operator serve in JavaScript?
addition and concatenation
what data type is returned by comparing two values?
a boolean
what does the += plus equals operator do?
adds then assigns new value
what are objects used for?
to group variables and functions
what are object properties?
variables within an object
describe object literal notation
{ key:value, key:value}
how do you remove a property from an object?
keyword delete & dot notation or square bracket notation
what are the two ways to get or update the value of a property?
dot notation and square bracket notation
what are arrays used for?
storing a list of values