JavaScript Flashcards
What is the purpose of variables?
Storing values under a specific name and stores data to be called upon when needed
How do you declare a variable?
Creating the variable with the keywords let const or var and giving it a name
How do you initialize (assign a value to) a variable?
Using the assignment operator(=) giving the variable a value
What characters are allowed in variable names?
Letter dollar sign or underscore, can’t start with numbers
What does it mean to say that variable names are “case sensitive”?
That variables name like score and Score are different variable names
What is the purpose of a string?
Storing a set of characters.
What is the purpose of a number?
handles numeric data types for mathematical operations
What is the purpose of a boolean?
Denote true or false, represents is or isn’t. Make decisions.
What does the = operator mean in JavaScript?
It means a variable is being assigned to a value.
How do you update the value of a variable?
You must assign the variable a new value, and not use the keyword since the variable already exists. var is only used for the first time.
What is the difference between null and undefined?
null is assigned by the developer purposefully! and means it does not exist. undefined is assigned by the browser and free to use.
Why is it a good habit to include “labels” when you log values to the browser console?
Labels describe the value or variable being logged, makes it clear what your working when you come back to the code
Give five examples of JavaScript primitives.
Boolean, int, string, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
Combines two string values together using the add operator, never changes the original makes a new string.
What purpose(s) does the + plus operator serve in JavaScript?
summing numerical data or concantenation
What data type is returned by comparing two values (<, >, ===, etc)?
Booleans, true or false
What does the += “plus-equals” operator do?
Adds the right operand to the variable and assigns the new value to the variable.
What are objects used for?
To group together a set of variables and function
What are object properties?
A variable that is inside of an object
Describe object literal notation.
Var name assignment operator(=) { ((object literal)
Properties and values seperates by : and commas separating those
};
How do you remove a property from an object?
Delete variablename.nameofproperty
What are the two ways to get or update the value of a property?
Variablename followed by period variable.propertyname or variablename[‘property’]
What are arrays used for?
to store a list of values as a variable that are USUALLY alike, and iterate through them one ate a time if needed