JavaScript Flashcards
What is the purpose of variables?
Store results, quantities, conditionals
How do you declare a variable?
Keyword var and variable name
How do you initialize (assign a value to) a variable?
Use ‘=’
What characters are allowed in variable names?
$, letters, numbers
What does it mean to say that variable names are “case sensitive”?
lowercase names are not the same as capitalizes names
What is the purpose of a string?
To manipulate text
What is the purpose of a number?
math and quantities
What is the purpose of a boolean?
conditionals
What does the = operator mean in JavaScript?
Assigning value
How do you update the value of a variable?
Assign a new value
What is the difference between null and undefined?
Different data types. Null always needs to be assigned.
Why is it a good habit to include “labels” when you log values to the browser console?
So you know what the logged values are for.
Give five examples of JavaScript primitives.
boolean, number, string, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
Appending strings to make a new string.
What purpose(s) does the + plus operator serve in JavaScript?
Adding numbers, concatenating strings
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
Adds/appends and assigns the new value
What are objects used for?
Store related values
What are object properties?
Keys to access object’s values
Describe object literal notation.
Curly braces + key, value pairs
How do you remove a property from an object?
delete object.property
What are the two ways to get or update the value of a property?
Dot notation or brackets
Why do we log things to the console?
To check for expected output of functions and objects