Javascript Flashcards
Javascript primitives and variables
What is the purpose of variables?
Store values
Javascript primitives and variables
How do you declare variable?
specify the type, leave at least one space, then the name for the variable and end the line with a semicolon ( ; ).
Javascript primitives and variables
How do you initialize (assign a value to) a variable?
const, let, var
Javascript primitives and variables
What characters are allowed in variable names?
period, underscore, $,#,@
Javascript primitives and variables
What does it mean to say that variable names are “case sensitive”?
Example
let apple
let Apple
they are different
Javascript primitives and variables
what is the purpose of a string?
It represents text
Javascript primitives and variables
What is the purpose of a number?
It represents number values
Javascript primitives and variables
What is the purpose of a boolean?
true/false statements
Javascript primitives and variables
What does the = operator mean in Javascript?
Compare values and calculation?
Javascript primitives and variables
How do you update the value of a variable?
var totalPets = 10000; totalPets = 23;
Javascript primitives and variables
What is the difference between null and undefined?
Null: intentional absence of the value
Undefined: The value doesn’t exist
Javascript primitives and variables
Why is it a good habit to include “labels” when you log values to the browser console?
Debugging, or know where you are at
Javascript primitives and variables
Give five examples of JavaScript primitives.
string, number, undefined, null, boolean
Javascript operators and expressions
What data type is returned by an arithmetic operation?
number
Javascript operators and expressions
What is string concatenation?
Adding strings with + operator
Javascript operators and expressions
What purpose(s) does the + plus operators serve in Javascript
Concatenation
arithmetic
Javascript operators and expressions
What data type is returned by comparing two values (, ===, etc?)
boolean
What are objects used for?
To shape a model, multiple types of data, or functions
What are object properties?
variables that are attached to the object
Describe object literal notation
{ key: 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 or bracket notation
What are arrays used for?
Store the data?
What are arrays used for?
Store the data?