JavaScript Flashcards
What is the purpose of variables?
variables give us permanents (store data to use later)
How do you declare a variable?
type the keyword var, let, const
How do you initialize (assign a value to) a variable?
use a single =
What characters are allowed in variable names?
letter, dollar sign, underscore, and numbers
What does it mean to say that variable names are “case sensitive”?
lowercase & uppercase matters in JS
What is the purpose of a string?
characters (store texts)
What is the purpose of a number?
calculations, any math related value
What is the purpose of a boolean?
potential to have logic (binary statement)
What does the = operator mean in JavaScript?
assignment operator (to put a value)
How do you update the value of a variable?
only write the variable name (without rewriting var)
What is the difference between null and undefined?
null is an assigned value. (made to be empty on purpose)
undefined means a variable has been declared but not defined yet.
Why is it a good habit to include “labels” when you log values to the browser console?
makes it easier to debug
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined, objects
What data type is returned by an arithmetic operation?
number
What is string concatenation?
addition for strings
What purpose(s) does the + plus operator serve in JavaScript?
add values or concatenate strings
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
allows you to add numbers or strings to an existing variable
What are objects used for?
grouping of data
What are object properties?
variables within a certain boundaries
Describe object literal notation.
variable = {
property: value }
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, bracket notation
What are arrays used for?
store set of orders