JavaScript Flashcards
What is the purpose of variables?
to see data from the past and preserve for the future (store and organize data)
How do you declare a variable?
var, let, or const
How do you initialize (assign a value to) a variable?
use equal sign assignment operator
What characters are allowed in variable names?
letters, underscore, dollarsigns, and numbers (cannot be first letter)
What does it mean to say that variable names are “case sensitive”?
casing matters (N and n matter when calling a variable)
What is the purpose of a string?
gives a variable a text value that is not code
what is the purpose of a number?
can give numerical values that mostly is used for math
What is the purpose of a boolean?
compare values using true or false
What does the = operator mean in JavaScript?
assigns a value
How do you update the value of a variable?
assign a new value using the equal operator
What is the difference between null and undefined?
null is assigned, where as undefined is when javascript tell you something is empty
Why is it a good habit to include “labels” when you log values to the browser console?
gives an identifier for your console log
Give five examples of JavaScript primitives.
numerical value, string, boolean, null, undefined,
What data type is returned by an arithmetic operation?
number
What is string concatenation?
appending a string to the end of another string
What purpose(s) does the + plus operator serve in JavaScript?
addition in math and concatention for strings
What data type is returned by comparing two values (, ===, etc)
boolean
What does the += “plus-equals” operator do?
it is the addition assignment plus whatever string or data type is being added from the original variable
What are objects used for?
group together data, create subdivisions of data
What are object properties?
they are sub divisions of objects that store similar data
Describe object literal notation.
curly braces
How do you remove a property from an object?
delete (name of propert)
What are arrays used for?
to store items with similar data with an order.
Describe array literal notation.
square bracket with data values inside