javaScript Flashcards
(27 cards)
What is the purpose of variables?
information to be referenced or manipulated later and a way of labeling data.
How do you declare a variable?
var and the “word”
How do you initialize (assign a value to) a variable?
= means assign
What characters are allowed in variable names?
number, letters, underscore
What does it mean to say that variable names are “case sensitive”?
they must be spelt and capitalized when referenced (camel case)
What is the purpose of a string?
let’s you work with a series of characters
What is the purpose of a number?
can be assigned as a value to a variable
What is the purpose of a boolean?
a true or false value the can be used later in some action
What does the = operator mean in JavaScript?
assigned
How do you update the value of a variable?
by assign it a different value with a function
What is the difference between null and undefined?
null is a assigned value & undefined has no value
Why is it a good habit to include “labels” when you log values to the browser console?
to keep information becoming confusing and debugging
Give five examples of JavaScript primitives.
string, boolean, number, null and undefined
What data type is returned by an arithmetic operation?
the return values are always based on the operands values before the operation
What is string concatenation?
sticking two strings together
What purpose(s) does the + plus operator serve in JavaScript?
The + operator is used to perform both addition and string concatenation
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
+= operator is used to concatenate strings or add numbers
What are objects used for?
store collection of related data (model)
What are object properties?
property is an association between a name (key) and a value
Describe object literal notation.
= { firstName: Jim; lastName: Smith; age: 18; }
How do you remove a property from an object?
the delete operator
What are the two ways to get or update the value of a property?
the dot method
or bracket notation
What are arrays used for?
lets you store multiple values in a single variable. It stores a fixed-size sequential collection of elements of the same type