JS-Primitives-Variables Flashcards
What is the purpose of variables?
To store data
How do you declare a variable?
var keyword
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
Everything except captial letter for the first letter
What does it mean to say that variable names are “case sensitive”?
Name and name are 2 different variables
What is the purpose of a string?
store text
What is the purpose of a number?
preform math
What is the purpose of a boolean?
which part of script should run
What does the = operator mean in JavaScript?
assinging value to a variable
How do you update the value of a variable?
variable name, equal sign, new value
What is the difference between null and undefined?
null can be set on purpose when you dont want to assign a variable a value yet
Why is it a good habit to include “labels” when you log values to the browser console?
easier to debug
Give five examples of JavaScript primitives.
number, string, boolean, undefined, null