JavaScript Flashcards
What is the purpose of variables?
Used to store data
How do you declare a variable?
var variableName;
How do you initialize (assign a value to) a variable?
var variableName = “string”
What characters are allowed in variable names?
letters, numbers, $ , and _.
What does it mean to say that variable names are “case sensitive”?
S != s. Uppercase and lowercase letters will be interpreted differently.
What is the purpose of a string?
Consists of letters and other characters. They are frequently used to add new content to a page and they can contain HTML markup
What is the purpose of a number?
Numeric data types handle numbers.
What is the purpose of a boolean?
Have one of two values: true or false. Booleans are helpful when determining which part of a script should run.
What does the = operator mean in JavaScript?
= assigs a value to a variable
How do you update the value of a variable?
assign a new value to the variable
Why is it a good habit to include “labels” when you log values to the browser console?
To avoid confusion of having multiple console.logs
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining multiple strings together
What purpose(s) does the + plus operator serve in JavaScript?
concatenation and addition
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
Adds by a specified value and sets the variable to the value of the expression
What are objects used for?
storing key-value pairs. Used to model real-life objects
What are object properties?
storage areas connected to an object that can store data
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?
dot notation and bracket notation
What are arrays used for?
Storing data. Particularly useful for lists.
Describe array literal notation.
[ value, value,… ]
How are arrays different from “plain” objects?
They are numerically indexed