JavaScript Flashcards
- What is the purpose of variables?
Stores data to be used later
- How do youdeclarea variable?
keyword name = value;
- How do you initialize (assign a value to) a variable?
assignment operator
- What characters are allowed in variable names?
anyletter, $ _ or number(cant be first character)
- What does it mean to say that variable names are “case sensitive”?
the case sizing matters
- What is the purpose of a string?
not code read by JS strings contain values to be saved as they are.
- What is the purpose of a number?
used for math, or numeric values
- What is the purpose of a boolean?
true or false, the logic of JS
- How do you update the value of a variable?
name = value;
- What is the difference betweennullandundefined?
null is intentionally assigned by programmer and is an intentional emptiness. Undefined is a JS assignment which declares a variable to have no arguments.
- Why is it a good habit to include “labels” when you log values to the browser console?
to see what your console log is
- Give five examples of JavaScript primitives.
boolean, null, undefined, string, number
- What data type is returned by an arithmetic operation?
numbers
- What is string concatenation?
combines words
- What purpose(s) does the+plus operator serve in JavaScript?
adds valuess and concatenates strings
- What data type is returned by comparing two values (,===, etc)?
boolean
- What does the+=”plus-equals” operator do?
adds values and assigns them
What are objects used for?
create a model for information, like a phonebook
what are object properties?
Obj {property: value}
Object literal notation
{value, value,….};
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 notation or square brackets
what are arrays used for
storing a list of information
describe array literal notation
[value,value,….];