JAVASCRIPT Flashcards
What is the purpose of variables?
store data
How do you declare a variable?
var let const
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
number, letter, underscore, $
What does it mean to say that variable names are “case sensitive”?
lowercase and uppercase matters
What is the purpose of a string?
store letters
What is the purpose of a number?
store numerical data
What is the purpose of a boolean?
true/false used to make decisions
What does the = operator mean in JavaScript?
assign
How do you update the value of a variable?
reassign a new value
What is the difference between null and undefined?
undefined: no value assigned
null: set to nothing
Why is it a good habit to include “labels” when you log values to the browser console?
to know what you are actually logging
Give five examples of JavaScript primitives.
number, string, boolean, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining strings
What purpose(s) does the + plus operator serve in JavaScript?
addition of numbers and concatenation of strings
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
assigns the value of the variable to the previous value plus right-side of operator
What are objects used for?
store multiple types of data that are related
What are object properties?
variables glued to objects
Describe object literal notation.
{key: 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?
object.property (dot notation)
object[‘property’] (square bracket notation)
What are arrays used for?
store data in order
Describe array literal notation.
var array = [ ]
How are arrays different from “plain” objects?
numeric indexes vs named properties
arrays have order