js primitives and variables Flashcards
What is the purpose of variables?
Store data to be used again
How do you declare a variable?
const, var, let
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
Variable names must begin with a letter, an underscore (_) or a dollar sign ($)
Variable names can only contain letters, numbers, underscores, or dollar signs
What does it mean to say that variable names are “case sensitive”?
The case of a character defines the variable as well
What is the purpose of a string?
To store characters in a sequence
What is the purpose of a number?
To store something that can do arithmetic
What is the purpose of a boolean?
to store a binary value
What does the = operator mean in JavaScript?
Assign
How do you update the value of a variable?
thing = new thing
What is the difference between null and undefined?
null is purposeful
undefined has never been assigned
Why is it a good habit to include “labels” when you log values to the browser console?
ease of reading
Give five examples of JavaScript primitives.
number, string, boolean, null, undefined