JS Flashcards
What is the purpose of variables?
vairable stores data and runs it into scripts
How do you declare a variable?
var + name
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
Num, string, boolean
What does it mean to say that variable names are “case sensitive”?
var keyword when called should match exact declaration
What is the purpose of a string?
storing text
What is the purpose of a number?
storing numerical values
What is the purpose of a boolean?
to see if a function should run or not (true or false)
What does the = operator mean in JavaScript?
Assignment operator
How do you update the value of a variable?
using var name and =
What is the difference between null and undefined?
null represents a non existent or invalid object, while undefined is a value assigned to a variable which doesn’t have an actual argument
Why is it a good habit to include “labels” when you log values to the browser console?
clarification
Give five examples of JavaScript primitives.
string, number, boolean, undefined, null
What data type is returned by an arithmetic operation?
math operations
What is string concatenation?
combining two string together
What purpose(s) does the + plus operator serve in JavaScript?
adding variables and concatenating strings
What data type is returned by comparing two values (, ===, etc)?
Boolean
What does the += “plus-equals” operator do?
adds compoundingly
What are objects used for?
Objects group together a set of variables to create a model
What are object properties?
variables which are part of the object
Describe object literal notation.
{}
How do you remove a property from an object?
delete.property
What are the two ways to get or update the value of a property?
objectname.property, or the bracket notation