Javascript Flashcards
What is the purpose of a variable?
to provide a place to store data to access
in the future
How do you declare a variable?
var variable = value
How do you initialize (assign a value to) a variable?
by using =, with variable on left side and value on right
What characters are allowed in variable names?
letters, dollar sign, underscore, numbers(but cannot start with number)
What does it mean to say that variable names are “case sensitive”?
that uppercase and lowercase are entirely separate entities
What is the purpose of a string?
to store non-numerical values + data
What is the purpose of a number?
to store mathematical operations + numerics
What is the purpose of a boolean?
to store the true/false values and make decisions
What does the = operator mean in JavaScript?
to assign
How do you update the value of a variable?
by changing value after the = sign
What is the difference between null and undefined?
null = purposefully put by human programmer undefined = organic javascript
Why is it a good habit to include “labels” when you log values to the browser console?
to make it easier to debug
ALWAYS label
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
numeric
What is string concatenation?
combining two string using concatenation operator (+)
What purpose(s) does the + (plus) operator serve in JavaScript?
- to concatenate
2. to add
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
takes current value of variable and adds new value to variable and returns value of it
What are objects used for?
useful for storing multiple pieces of data that are related to each other
What are object properties?
names of the related pieces of objects
Describe object literal notation.
a set of curly braces, with keys and values within them
How do you remove a property from an object?
the delete operator
What are the two ways to get or update the value of a property?
dot notation and square bracket notation
ALWAYS use dot notation
What are arrays used for?
making lists of related data of the same type