JavaScript Flashcards
What is the purpose of variables?
Store data
How do you declare a variable?
with var
How do you initialize (assign a value to) a variable?
with the assignment operator (=)
What characters are allowed in variable names?
Letters, Characters, numbers, nonpunctuation characters
What does it mean to say that variable names are “case sensitive”?
sensitive to uppercase and lowercase letters
What is the purpose of a string?
to display text
What is the purpose of a number?
For any numeric function
What is the purpose of a boolean?
True or False
What does the = operator mean in JavaScript?
it assigns a value
How do you update the value of a variable?
using the dot (.)
What is the difference between null and undefined?
Null is an assigned value, Undeclared has not been assigned.
Why is it a good habit to include “labels” when you log values to the browser console?
To show you what you are logging
Give five examples of JavaScript primitives.
string, number, null, boolean, undefined
What is string concatenation?
Adding two or more strings together
What purpose(s) does the + plus operator serve in JavaScript?
to combine
What data type is returned by comparing two values (, ===, etc)?
true or false
What does the += “plus-equals” operator do?
adds the variable on the right to the left and assigns it back into the variable on the left
What are objects used for?
to store multiple properties, and to know where the data is, and to use that data together
What are object properties?
a single value stored on an object
Describe object literal notation.
var followed by curly braces with properties inside
How do you remove a property from an object?
the delete operator
What are the two ways to get or update the value of a property?
with the dot or brackets
What are arrays used for?
a data structure that stores a collection of data
Describe array literal notation.
An array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets ( [] ).