javascript-primitives-and-variables Flashcards
What is the purpose of variables?
storing information for later use.
How do you declare a variable?
var then name it
How do you initialize (assign a value to) a variable?
using the assignment operator “=”
What characters are allowed in variable names?
_, $, and letters and numbers
What does it mean to say that variable names are “case sensitive”?
that casing matters
What is the purpose of a string?
to store text
What is the purpose of a number?
to store numbers as values
What is the purpose of a boolean?
to show truthy or falsy, often used for turning on code
What does the = operator mean in JavaScript?
the assignment operator
How do you update the value of a variable?
assign a new value to that variable
What is the difference between null and undefined?
null is intentionally empty, will be updated later. undefined means a value has been declared by has no value.
Why is it a good habit to include “labels” when you log values to the browser console?
makes it easier to debug
Give five examples of JavaScript primitives.
string, boolean, number, undefined and null