JavaScript Flashcards
What is the purpose of variables?
to store data to use later on
How do youdeclarea variable?
keyword like var let or const
How do you initialize (assign a value to) a variable?
With the assignment operator =
What characters are allowed in variable names?
underscore, $, letters (upper/lower) numbers
What does it mean to say that variable names are “case sensitive”?
Having an uppercase letter will declare a different variable
What is the purpose of a string?
To represent text, that is not code
What is the purpose of a number?
to perform calculations
What is the purpose of a boolean?
how we make decisions in code
to identify data as either true or false
What does the=operator mean in JavaScript?
that you are assigning a value to a variable
How do you update the value of a variable?
assign another value to it
What is the difference betweennullandundefined?
Null is used intentionally, null can only be assigned. Either it’s empty because you are going to update it later or to signify nothing will be there.
undefined is used by the computer to signify an error
Why is it a good habit to include “labels” when you log values to the browser console?
For debugging, but also to organize your data so you know what you are looking at
Give five examples of JavaScript primitives.
String, boolean, number, null, undefined
What data type is returned by an arithmetic operation?
number
What is string concatenation?
addition for strings
What purpose(s) does the+plus operator serve in JavaScript?
addition (numbers) or concatenation (strings)
What data type is returned by comparing two values (,===, etc)?
boolean
What does the+=”plus-equals” operator do?
adds the assigned value to the variable
What are objects used for?
Store data that are related
What are object properties?
Variables within a group
Describe object literal notation.
curly brackets properties and values
How do you remove a property from an object?
Delete operator
What are the two ways to get or update the value of a property?
dot notation and/or bracket notation
what are arrays used for?
Store related content in a list