JS Primitives and Variables Flashcards
What is the purpose of variables?
to store information in order to do its job
How do you declare a variable?
var variable name
How do you initialize (assign a value to) a variable?
assignment operator (= equal sign)
What characters are allowed in variable names?
numbers letters $ underscores
What does it mean to say that variable names are “case sensitive”?
uppercase and lowercase matter
What is the purpose of a string?
to store text
What is the purpose of a number?
to store numbers as a value
What is the purpose of a boolean?
To determine if something is truthy or falsy
What does the = operator mean in JavaScript?
assignment operator
How do you update the value of a variable?
declare and assign a new value
What is the difference between null and undefined?
undefined represents a variable that is declared with no value
Null represents an empty value
Why is it a good habit to include “labels” when you log values to the browser console?
For clarity on what they are + makes code easier to debug
Give five examples of JavaScript primitives.
undefined Boolean String Number null