Javascript Flashcards
What is the purpose of variables?
To store data to use again in the future.
How do you initialize (assign a value to) a variable?
var keyword var name = var value;
What characters are allowed in variable names?
Letters, Numbers, Underscore, and dollarsign.
What does the = operator mean in JavaScript?
Assignment.
What does it mean to say that variable names are “case sensitive”?
Uppercase and lowercase variable names are not equal,
What is the purpose of a string?
sequence of characters that represent text
What is the purpose of a number?
represents a numeric data type that allows us to perform mathematical operations on it
What is the purpose of a boolean?
Lets the computers ultimately decide what to do or not do.
What is the difference between null and undefined?
undefined: JavaScript’s method of saying “empty”
null: developer’s way of saying “empty”; assigned intentionally
What data type is returned by an arithmetic operation?
number
What is string concatenation?
adding two strings together
What purpose(s) does the + plus operator serve in JavaScript?
addition and string concatenation
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adds/concatenates the value on the right with the value on the left and then assigns it to the variable on the left.
What are objects used for?
to group relevant data together
What are object properties?
variables that live within an object
Describe object literal notation.
var keyword var name = { };
How do you remove a property from an object?
Using the delete operator
delete object.property
What are the two ways to get or update the value of a property?
dot notation (object.property = value)
bracket notation (object[‘property’] = value)
What are arrays used for?
Useful when working with lists or groups of similar data
Describe array literal notation.
var varName = [list contents (separated by comma)]
How are arrays different from “plain” objects?
values assigned to index numbers rather than keys
order is preserved in arrays
What number represents the first index of an array?
0
What is the length property of an array?
returns how many things are stored in the list