Javascript Flashcards
What is the purpose of variables?
to use later
How do you declare a variable
var
How do you initialize (assign a value to) a variable?
var name = value
What character are allowed in a variable name?
letter, $, underscore _, number but not start with a number
What does it mean to say that variable names are case sensitive?
different variables if casing is different
What is the purpose of a string?
arguments
What is the purpose of a number?
numerical value
What is the purpose of a boolean?
true/false, data type
How do you update the value of a variable?
var name = value, no need to add var in front of var name
What is the difference between null and undefined?
null needs to be purposefully assigned made to be empty to be filled later
Why is it a good habit to include “labels” when you log values to the browser console?
easier to debug later
Give five examples of Javascript primitives?
string, number, boolean, null, undefined
Give five examples of Javascript primitives?
string, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
numerical
What is string concatenation?
tie two strings together
What purpose(s) does the + plus operator server in JavaScript
concatenation, add +
What data type if returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
addition assignment, take result as new value
What are objects used for?
grouping multiple properties with values that are related to each other
What are objects properties?
variables glued to objects
Describe object literal notation.
arraysof properties to their values
How do you remove a property from an object?
delete object.property
What are the two ways to get or update the value of a property?
property.nameOfvalue, or property[‘nameOfvalue’], and delete property.nameOfvalue
What are arrays used for?
lists of the same purpose/context rather than related