JavaScript Flashcards
(129 cards)
What is the purpose of variables?
to be able to store and reference data
How do you declare a variable?
use the keyword var with its name
How do you initialize (assign a value to) a variable?
use =
What characters are allowed in variable names?
anything but cannot start with a number or a be a keyword
What does it mean to say that variable names are “case sensitive”?
capital letters are not the same as lowercase letters
What is the purpose of a string?
to store words into javascript
What is the purpose of a number?
used for counting and arithmetic
What is the purpose of a boolean?
to state yes or no within javascript
What does the = operator mean in JavaScript?
assign to
How do you update the value of a variable?
use the assign to and value
What is the difference between null and undefined?
null is empty on purpose. Undefined is nothing is defined (usually accident)
Why is it a good habit to include “labels” when you log values to the browser console?
So console can be organized and easier to read
Give five examples of JavaScript primitives.
String, Number, Boolean, Null, Underfined
What data type is returned by an arithmetic operation?
a number
What is string concatenation?
combining strings
What purpose(s) does the + plus operator serve in JavaScript?
add or concatenation
What data type is returned by comparing two values (, ===, etc)?
Boolean
What does the += “plus-equals” operator do?
take the variable and update value
What are objects used for?
a box to keep related stuff together
What are object properties?
exclusive variables for an object
How do you remove a property from an object?
Use the delete operator (ex: delete person.firstName)
What are the two ways to get or update the value of a property?
dot notation or with brackets
What is a function in JavaScript?
group of actions that are repeatable
Describe the parts of a function definition.
keyword function, function name, ( ) with parameaters if there are any, { }, return