Javascript Flashcards
What is the purpose of variables?
To store data to use a later time
How do you declare a variable?
Use the keyword Var
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
Letters, Numbers, Underscores and $
What does it mean to say that variable names are “case sensitive”?
Variables are specific to how they are typed
What is the purpose of a string?
To store and manipulate text
What is the purpose of a number?
To store a value
What is the purpose of a boolean?
To determine if something is false or true
What does the = operator mean in JavaScript?
Assigning a value to a variable
How do you update the value of a variable?
Change the value
What is the difference between null and undefined?
Null is an empty value and Undefined means that variable has been declared but not defined
Why is it a good habit to include “labels” when you log values to the browser console?
Point of reference
Give five examples of JavaScript primitives.
String Numbers Null Undefined Boolean
What data type is returned by an arithmetic operation?
Number
What is string concatenation?
Combination of 2 or more string values
What purpose(s) does the + plus operator serve in JavaScript?
To add values or concatenate strings
What data type is returned by comparing two values (, ===, etc)?
Boolean
What does the += “plus-equals” operator do?
Adds the value of the right operand to the variable and the assigns the result to the variable
What are objects used for?
To group variables or functions
What are object properties?
Variables stored in an obeject
Describe object literal notation.
{properties: 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 Bracket Notation
What are arrays used for?
To be put in a list