JavaScript Flashcards
(118 cards)
what is the purpose of a variable?
variables store a value of something
how do you declare a variable?
use the keyword var then the name of the variable
How do you initialize (assign a value to) a variable?
You’d use the assignment operator
What characters are allowed in variable names?
underscore dollar sign and letters
What does it mean to say that variable names are “case sensitive”?
If its not case sensitive then they are different values
What is the purpose of a string?
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
what does the = operator mean in JS
the assignment operator
How do you update the value of a variable
set the value to the right of the assignment operator
What is the difference between null and undefined?
Null is a placeholder and undefined is javascript way of saying empty
They both mean empty, lack of value datatypes. Undefined is under the control of javascript. Null has to be assigned by an assignment operator. Somewhere down the line of history a human being came down and assigned null.
Why is it a 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, boolean, undefined, numbers, and null.
What data type is returned by an arithmetic operation?
a number
What is string concatenation?
adds numbers and concatenates strings together
What purpose(s) does the + plus operator serve in JavaScript?
its the addition operator
What data type is returned by comparing two values (, ===, etc)?
a boolean
What does the+=”plus-equals” operator do?
The addition assignment operator (+=) 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
the object name curly braces and key value pairs
How do you remove a property from an object?
delete operator
What are two ways to get or update the value of a property?
dot and bracket notation
What are arrays used for?
It stores a list of values/groups of similar data.