javascript-primitives-and-variables Flashcards
What is the purpose of variables?
to store data that may vary
How do you declare a variable?
var variableName
How do you initialize (assign a value to) a variable?
= variableVaule
What characters are allowed in variable names?
letters digits and nonpunctuation, $, _ (except that a period (.))
What does it mean to say that variable names are “case sensitive”?
they have to be exactly the same
What is the purpose of a string?
to add text
What is the purpose of a number?
for tasks that involve counting or calculating sums
What is the purpose of a boolean?
true or false statements
What does the = operator mean in JavaScript?
assignment
How do you update the value of a variable?
variableName = update
What is the difference between null and undefined?
null is intently lack of undefined is not defined
Why is it a good habit to include “labels” when you log values to the browser console?
so you know what variable/scripts you are logging and helps with debugging
Give five examples of JavaScript primitives.
null, undefined, number, string, boolean