Javascript Flashcards
What is the purpose of variables
variables hold a value of something
How do you declare a variable?
use the operator to declare a variable
How do you initialize ( assign a value to) a variable
you’d use the assignment operator
What characters are allowed in variable names?
letters dollar signs and underscore and numbers as long as it doesnt start with a number
What does it mean to say that variable names are “case sensitive”?
If its not case sensitive then two of the same words are different values
what is the purpose of a string?
Its a series of characters in a row. Data that is not code.
what is the purpose of a number?
calculations
What is the purpose of a boolean
to represent logic values and see whether its true or false
What does the = operator mean in JavaScript?
Its the assignment operator
How do you update the value of a variable?
set the old value on the left of the assignment operator and the new value on the right
What is the difference between null and undefined?
Null is a placeholder and undefined is javaScripts way of saying empty
Why is it good habit to include “labels” when you log values to the browser console?
It’ll give us a point of reference
Give five examples of JavaScript primitives
Strings, booleans, undefined, numbers, and null.
What data type is returned by an arithmetic operation?
A number.
What is string concatenation?
Joining two or more values together to form a new string.
What purpose(s) does the + operator serve in JavaScript?
To add numbers and to concatenate strings
What data type is returned by comparing two values
booleans
What does the += “plus-equals” operator do?
adds the value of the right operand to a variable and assigns the result to the variable
What are objects used for?
To create a model of something you would recognize in the real world. All stored together in one area
What are object properties?
They tell us about the object. Variables that live inside an object.
Describe object literal notation
The object the key value pairs inside curly braces
How do you remove a property from an object.
The delete operator
What are the two ways to get or update the value of a property?
Dot notation and bracket notation
What are arrays used for
it stores a list of values/groups of similar data