javascript Flashcards
(146 cards)
What is the purpose of variables?
used to store information to be referenced and manipulated
How do you declare a variable?
by using the var keyward
How do you initialize (assign a value to) a variable?
by adding an equal sign to the right of the variable name
What characters are allowed in variable names?
The period, the underscore, and the characters $, #, and @
What does it mean to say that variable names are “case sensitive”?
it means that names need to be identical
What is the purpose of a string?
used for data values that are made up of ordered sequences of characters
What is the purpose of a number?
to give a number value to a variable
What is the purpose of a boolean?
to assign true or false to a variable
What does the = operator mean in JavaScript?
to assign
How do you update the value of a variable?
by reassigning it
What is the difference between null and undefined?
null is set but undefined is a return value set by javaScript
Why is it a good habit to include “labels” when you log values to the browser console?
to identify which console log belongs to which.
Give five examples of JavaScript primitives.
string, null, numbers , undefined boolean
What data type is returned by an arithmetic operation?
numbers
What is string concatenation?
adding 2 strings together
What purpose(s) does the + plus operator serve in JavaScript?
addition
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adds and assign
What are objects used for?
Objects group together a set of variables and functions
What are object properties?
a simple association between name and value
Describe object literal notation.
an array of key:value pairs
How do you remove a property from an object?
by using the delete operator
What are the two ways to get or update the value of a property?
by dot notation and bracket notation
What are arrays used for?
to store more then one information at a time