JavaScript Flashcards
(89 cards)
What is the purpose of variables?
to hold values
How do you declare a variable?
var let const
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
$_ letters and numbers
What does it mean to say that variable names are “case sensitive”?
casing matters
What is the purpose of a string?
for storing and manipulating text
What is the purpose of a number?
math
What is the purpose of a boolean?
to show true or false
What does the = operator mean in JavaScript?
assign
How do you update the value of a variable?
the variable name = new value
What is the difference between null and undefined?
null have a value while undefined does not
Why is it a good habit to include “labels” when you log values to the browser console?
to keep track of what you are logging
Give five examples of JavaScript primitives.
number, string, boolean, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining 2 strings into one +=
What purpose(s) does the + plus operator serve in JavaScript?
addition
What data type is returned by comparing two values (<, >, ===, etc)?
boolean
What does the += “plus-equals” operator do?
addition -> assignment
What are objects used for?
to store data in an unordered list type structure
What are object properties?
variables, but for objects
Describe object literal notation.
var newObject = { };
How do you remove a property from an object?
delete operator
What are the two ways to get or update the value of a property?
dot or bracket notation
What are arrays used for?
To store data of the same type together in the same place