Primitives and Variables Flashcards
What is the purpose of variables?
A way to store values so we can use them later.
How do you declare a variable?
Creating a variable and giving it a name (variable keyword variable name )
How do you initialize (assign a value to) a variable?
By using the assignment operator (=)
What characters are allowed in variable names?
Names can contain letters, numbers, underscores, and dollar signs (cannot start with numbers).
What does it mean to say that variable names are “case sensitive”?
Identifiers must always be typed with a consistent capitalization of letters (camel is not the same as Camel)
What is the purpose of a string?
storing and manipulating text
What is the purpose of a number?
storing numeric data type
What is the purpose of a boolean?
having one of two values: true or false (when scripts should be run).
What does the = operator mean in JavaScript?
Assign values to variables.
How do you update the value of a variable?
use name variable and assign it to a new value (does not need variable keyword).
What is the difference between null and undefined?
Null: It is the intentional absence of the value. Undefined: It means the value does not exist in the compiler.
Why is it a good habit to include “labels” when you log values to the browser console?
Challenge to know what value is what without labels
Give five examples of JavaScript primitives.
Numbers, strings, null, undefined, and boolean.