JavaScript Flashcards
What is the purpose of variables?
assign values
How do you declare a variable?
use var, let, const
How do you initialize a variable?
equal sign
What characters are allowed in variables names?
must begin with a letter, dollar sign, or underscore
can contain numbers but cannot use a dash or period
cannot use keywords or reserved words
case sensitive
What dose it mean to say that variable names are case sensitive?
if two variables are spelled the same way but have different casing, then js treats them as two different variables
What is the purpose of a string?
to store characters
What is the purpose of a number?
to store numbers
What is the purpose of a boolean?
to store something as true or false
What does the = equals sign operator mean in JS
assign a variable
How do you update the value of a variable?
you use the equal sign operator again
What is the difference between null and undefined?
a null value represents a reference that points, generally intentionally, to a nonexistent or invalid object or address
a variable is undefined when a value is not assigned to it
Why is it a good habit to include labels when you log values to the browser console?
This will allow you to see if what you are storing is good and makes sense
Give five examples of JavaScript primitives
string, number, boolean, undefined, symbol, null
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining strings together
What purpose(s) does the + plus operator serve in JS?
addition, incrementing, concatenation
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equal” operator do?
adding or concatenating something to itself
What are objects used for?
store multiple types of data
What are object properties?
object properties are the keys of data that are stored in an object
Describe object literal notation
declare a variable, assignment operator, curly brackets
How do you remove a property from an objects?
use delete function
What are the two ways to get or update the value of a property?
dot and bracket notation
What are arrays used for?
ordered lists and groupings of information