JAVASCRIPT Flashcards
- How do youdeclarea variable?
var nameOfVariable
- How do you initialize (assign a value to) a variable?
nameOfVariable = sting, number, or boolean
- What characters are allowed in variable names?
letter, underscore, or dollar sign
- What does it mean to say that variable names are “case sensitive”?
superMan will be different than superman
- What is the purpose of a string?
for letters and other characters not considered code
- What is the purpose of a number?
to display numbers
- What is the purpose of a boolean?
to display whether something is true or false - works as switch
- What does the=operator mean in JavaScript?
does not mean equal, means assign
- How do you update the value of a variable?
variableName then assign new value
- What is the difference betweennullandundefined?
null is predictable, set by developer… undefined has no value
- Why is it a good habit to include “labels” when you log values to the browser console?
to identify what our log is
- Give five examples of JavaScript primitives.
string, number, boolean, null, undefined
- What data type is returned by an arithmetic operation?
number
- What is string concatenation?
adding two strings together
- What purpose(s) does the+plus operator serve in JavaScript?
to add two values, string and string, number and number, or mix
- What data type is returned by comparing two values (,===, etc)?
boolean
- What does the+=”plus-equals” operator do?
shorthand operator that adds right operand to left operand and assigns back to left operand
- What are objects used for?
to store information about something
- What are object properties?
variable in the confines of an object, place to store data that can be accessed
later
- Describe object literal notation.
{ property: value };
- How do you remove a property from an object?
delete operator, dot or bracket
- What are the two ways to get or update the value of a property??
dot notation or bracket notation
- What are arrays used for?
to store lists of similar data
- Describe array literal notation.
declare variable/array then assignment, then opening bracket for array, list properties, closing bracket of array