JavaScript Flashcards
What is the purpose of variables?
To store data into
How do you declare a variable?
var variable name;
How do you initial (assign a value to) a variable?
=
What characters are allowed in variable names?
Letters, numbers, &, _
What does it mean to say that variable names are “case sensitive?”
Variables of the same name have to be typed with the same capitalization
What is the purpose of a string?
Store or manipulate text
What is the purpose of a number?
Store or manipulate numbers
What is the purpose of a boolean?
Data type showing binary states, true/false
What does the = operator mean in JavaScript?
Assigning a value to a variable
How do you update the value of a variable?
Reassign variable to a new value
What is the difference between null and undefined?
Null: non-existent or invalid object, null cannot be created unorganically, purposeful emptiness
Undefined: assigned to a variable with nothing
Why is it a good habit to include “labels” when you log values to the browser?
More clear which variables are being logged and in what order
Give five examples of JavaScript primitives
String, number, bigint, boolean, undefined, symbol, null
What data type is returned by an arithmetic operation?
Number
What is string concatenation?
The joining of two or more strings to create on string
What purpose(s) does the + plus operator serve in JavaScript?
Adding one value to another
What data type is returned by comparing two values (, ===, etc)?
Boolean
What does the += “plus-equals” operator do?
Add the value of the right operand to a variable and assigns the result to a variable
What are objects used for?
Groups a set of variables and functions
What are object properties?
Variables within a certain boundary in a storage location
Describe object literal notation
{ property: value, }
How do you remove a property from an object?
Delete
What are the two ways to get or update the value of a property?
Dot notation, bracket notation
What are arrays used for?
Stores a list of values