JS week 1 day 1 Flashcards
What is the purpose of variables?
variable stores the data value that can be changed later on
How do you declare a variable?
use keyword var, let or const
How do you initialize (assign a value to) a variable?
by using = operator
What characters are allowed in variable names?
letters, underscore, dollar sign, subsequent characters can be numbers, no spaces
What does it mean to say that variable names are “case sensitive”?
if variable names include same letters but one cases do not match, strings values do not equate to each other
What is the purpose of a string?
JavaScript strings are used for storing and manipulating text.
What is the purpose of a number?
to perform arithmetic operations, and describe/store numeric values.
What is the purpose of a boolean?
Booleans are used as functions to get the values of variables, objects, conditions, and expressions. true/false
What does the = operator mean in JavaScript?
assignment operator
How do you update the value of a variable?
remove the declaration key word, variable name = “different value”
What is the difference between null and undefined?
undefined means a variable has been declared but has not yet been assigned a value. null is an assignment value but can be assigned to a variable as a representation of no value. ( null = intentional absence of value)
Why is it a good habit to include “labels” when you log values to the browser console?
to help debug
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
appends one string to the end of another string