JavaScript Flashcards
What is the purpose of variables?
store date for later use with a name
How do you declare a variable?
keyword var
How do you initialize (assign a value to) a variable?
= sign
What characters are allowed in variable names?
_$@#1 and letters, cant start with #
What does it mean to say that variable names are “case sensitive”?
needs consistency with uppercase/lowercase
What is the purpose of a string?
hold letters/characters
What is the purpose of a number?
hold numeric values
What is the purpose of a boolean?
logical value true/false
What does the = operator mean in JavaScript?
assign value
How do you update the value of a variable?
assign it a new value
What is the difference between null and undefined?
null is intentional and is assigned/ undefined is not intentional and is not assigned
Why is it a good habit to include “labels” when you log values to the browser console?
so you know what output is for what console log
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined, symbol, bigint
What data type is returned by an arithmetic operation?
number
What data type is returned by an arithmetic operation?
number
What is string concatenation?
joining/combining 2 strings together for a new string
What purpose(s) does the + plus operator serve in JavaScript?
adding 2 values or concatenating
What data type is returned by comparing two values (, ===, etc)?
boolean T/F
What does the += “plus-equals” operator do?
addition assignment, adds additional info to variable to add to
What are objects used for?
grouping together variables and functions
What are object properties?
additional information for the object, name/value, individual keys in an objects
Describe object literal notation.
var object = { # = 1 } declare variable and assign property/value
How do you remove a property from an object?
using delete operator then dot notation for object.property
What are the two ways to get or update the value of a property?
bracket notation, dot notation