Javascript Flashcards
What is the purpose of variables?
used to store information to be referenced and manipulated in a computer program
How do you declare a variable?
with a var, let or const
How do you initialize (assign a value to) a variable?
using the assignment operator
What characters are allowed in variable names?
letters, numbers, dollar signs, nonpunctuation characters
What does it mean to say that variable names are “case sensitive”?
takes account lower or uppercase
What is the purpose of a string?
holds text characters, literal constant
What is the purpose of a number?
stores numbers…
What is the purpose of a boolean?
determines true or false
What does the = operator mean in JavaScript?
assignment operator
How do you update the value of a variable?
reassignment
What is the difference between null and undefined?
null means no value, undefined means just not defined at all
Why is it a good habit to include “labels” when you log values to the browser console?
gives a good point of reference
Give five examples of JavaScript primitives.
String, boolean, number, null and undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
operation of joining character strings end-to-end
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 the value on the right, to the variable on the left, and then assigns that value back into the variable on the left
What are objects used for?
stores its state in fields
What are object properties?
Object properties are defined as a simple association between name and value
Describe object literal notation.
an array of key:value pairs, with a colon separating the keys and values, and a comma after every key:value pair, except for the last
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
object.property
object[‘property’]
What are arrays used for?
ordered lists