javascript-primitives-and-variables Flashcards
What is the purpose of variables?
Variables are used to store information to be referenced and manipulated in a computer program.
How do you declare a variable?
Var
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
$, _,
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?
used to represent text
What is the purpose of a number?
used to represent numbers
What is the purpose of a boolean?
for true or false
What does the = operator mean in JavaScript?
assigned to
How do you update the value of a variable?
variable = new value
What is the difference between null and undefined?
null is a special value meaning “no value”
undefined means that the variable has not been declared,
or has not been given a value.
Why is it a good habit to include “labels” when you log values to the browser console?
help with debugging
Give five examples of JavaScript primitives.
undefined , null , boolean , string and number