JavaScript Flashcards
What is the purpose of variables?
a vehicle to have permanence of data
How do you declare a variable?
var keyword
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
letters, number $ and _
What does it mean to say that variable names are “case sensitive”?
uppercase =/= lowercase
What is the purpose of a string?
to hold text
What is the purpose of a number?
for math
What is the purpose of a boolean?
for conditionals, to make decisions
What does the = operator mean in JavaScript?
value is being assigned to
How do you update the value of a variable?
reassign new value (=)
What is the difference between null and undefined?
Null is an assigned value without value, undefined has never been assigned
Why is it a good habit to include “labels” when you log values to the browser console?
for context in the output
Give five examples of JavaScript primitives.
string, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
A number
What is string concatenation?
joining strings together
What purpose(s) does the + plus operator serve in JavaScript?
concatenation or addition
What data type is returned by comparing two values (<, >, ===, etc)?
boolean
What are objects used for?
To store multiple variables under one name
What are object properties?
individual piece of named data within an object
Describe object literal notation.
var object = {} with commas after each new variable
How do you remove a property from an object?
with the delete operator
What are the two ways to get or update the value of a property?
dot or square bracket notation
What is a function in JavaScript?
A repeatable set of actions with a specific name
Describe the parts of a function definition
Function keyword with the name of the function followed by () with optional parameters inside, curly braces with code inside and a return statement to give back a value