JavaScript Flashcards
How do you declare a variable?
var, let, or const then name
How do you initialize (assign a value to) a variable?
equal ( = ) sign
What characters are allowed in variable names?
letters, numbers, symbols
What does it mean to say that variable names are “case sensitive”?
“name” is different from “Name”
What is the purpose of a string?
text content
What is the purpose of a number?
math stuff
What is the purpose of a boolean?
determine true or false
What does the = operator mean in JavaScript?
is assigned to
How do you update the value of a variable?
variable name = ‘new value’
What is the difference between null and undefined?
null - placed there on purpose, doesn’t exist
undefined - there’s nothing assigned to a variable
Why is it a good habit to include “labels” when you log values to the browser console?
to keep track of what the logs are for
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
putting two strings together
What purpose(s) does the + plus operator serve in JavaScript?
addition or concatenating strings
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adding something to the variable, then updating that variable
What does the += “plus-equals” operator do?
adding something to the variable, then updating that variable
What are objects used for?
key, value lists
What are object properties?
variables specifically for objects
Describe object literal notation.
variable name, the curly-braces surrounding key-value pairs, separated by commas
How do you remove a property from an object?
delete operator then obj.key
What are the two ways to get or update the value of a property?
dot notation, or bracket notation
What are arrays used for?
lists