JavaScript Flashcards
What is the purpose of variables?
to store data and information to be used later. keeps a history of data
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, $, _, numbers(numbers cannot be the first character)
What does it mean to say that variable names are “case sensitive”?
casing matters in variables
What is the purpose of a string?
to be able to give a variable a value of text
What is the purpose of a number?
to assign variables a numerical value
What is the purpose of a boolean?
making decisions
What does the = operator mean in JavaScript?
assigns a value to something so that it will contain it
How do you update the value of a variable?
declare and assign it a new value
What is the difference between null and undefined?
null is an empty value purposely given while undefined means nothing is defined yet
Why is it a good habit to include “labels” when you log values to the browser console?
specifies what the value relates to
Give five examples of JavaScript primitives.
boolean string number null undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
appending a string to another end of a string
What purpose(s) does the + plus operator serve in JavaScript?
string concatenation and addition
What data type is returned by comparing two values (< , > , ===, etc)?
boolean
What does the += “plus-equals” operator do?
addition assignment and the result of that will be the updated value
What are objects used for?
to store multiple types of data
What are object properties?
a piece of data stored in an object
Describe object literal notation.
data within a { and a , separating each one
How do you remove a property from an object?
delete object.property
What are the two ways to get or update the value of a property?
dot notations and square brackets
What are arrays used for?
objects with similar data types in a list format