Javascript Flashcards
(123 cards)
What is the purpose of variables?
To store data
How do you declare a variable?
Using the variable keyword and variable name
How do you initialize (assign a value to) a variable?
Write the variable name, and use the assignment operator to assign it to a value
What characters are allowed in variable names?
The name can contain letters, numbers, dollar sign ($), or an underscore (_).
What does it mean to say that variable names are “case sensitive”?
the capitalization must be consistent
What is the purpose of a string?
The String object is used to represent and manipulate a sequence of characters.
What is the purpose of a number?
represent and manipulate numbers
What is the purpose of a boolean?
to hold data types of true or false
What does the = operator mean in JavaScript?
assign a value into a variable
How do you update the value of a variable?
name of variable, assignment operator and the new value
What is the difference between null and undefined?
undefined has not been assigned a value yet. null intentionally has no value.
Why is it a good habit to include “labels” when you log values to the browser console?
helpful to debug
Give five examples of JavaScript primitives.
string, number, boolean, undefined and null
What data type is returned by an arithmetic operation?
number value
What is string concatenation?
to add two strings so they become a single value
What purpose(s) does the + plus operator serve in JavaScript?
to add numeric values or concatenate one string into another
What data type is returned by comparing two values (<, >, ===, etc)?
boolean
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?
group together a set of variables and functions
What are object properties?
variable that is attached to the object and we can store data
Describe object literal notation.
variable, assigning operator , curly braces, and collection of property and values
How do you remove a property from an object?
use the delete keyword followed by the object name and property
What are the two ways to get or update the value of a property?
using dot notation or bracket notation
What are arrays used for?
It stores a list of values