JavaScript Flashcards
What is the purpose of variables?
Give the browser a short term memory of certain bits. to use later on.
How do you declare a variable?
var keyword: var name = var value;
How do you initialize (assign a value to) a variable?
var name = value; use single equal signs
What characters are allowed in variable names?
letters and dollar signs and underscore and number but you cant start with number
What does it mean to say that variable names are “case sensitive”?
lower and upper cases matter (cats is not the same as Cats)
What is the purpose of a string?
to store text
What is the purpose of a number?
to store numbers
What is the purpose of a boolean?
give data either true or false. logic with binary state, on/off
What does the = operator mean in JavaScript?
assignment operator
How do you update the value of a variable?
variable name = new value;
What is the difference between null and undefined?
null if intentional missing of data where as undefined is missing where its suppose to be
Why is it a good habit to include “labels” when you log values to the browser console?
to know which variables if logging and which is not to make it easier to debug code and read.
Give five examples of JavaScript primitives.
Number, null, undefined, Boolean, string, array , object
What data type is returned by an arithmetic operation?
number
What is string concatenation?
the process of combining multiply strings into one
What purpose(s) does the + plus operator serve in JavaScript?
additions in numeric values or concationate strings
What data type is returned by comparing two values (, ===, etc)?
Booleons
What does the += “plus-equals” operator do?
it add the data to the variables and set the new value as the variables
(num = num + 10 is the same num += 10)
What are objects used for?
a group or set of variables and function.
What are object properties?
variables but they are apart of the object (boundaries)
Describe object literal notation.
opening brace and then properties then value then closing
How do you remove a property from an object?
delete operator
What are the two ways to get or update the value of a property?
dot notation or bracket notation
What are arrays used for?
store lists of values