Javascript Flashcards
What is the purpose of variables?
To store data.
How do you declare a variable?
keyword(var, let, const) with a space followed by the variable number.
How do you initialize (assign a value to) a variable?
Using the assignment operator ‘=’
What characters are allowed in variable names?
start with $ _ or letters, and can have numbers and letters in it.
What does it mean to say that variable names are “case sensitive”?
javascript reads capitals as a differnet letters.
What is the purpose of a string?
To store text data.
What is the purpose of a number?
To store numbers for use in math.
What is the purpose of a boolean?
As a ‘on, off’ switch.
What does the = operator mean in JavaScript?
It assigns the value to a variable.
How do you update the value of a variable?
using a the variable name and assignment operator.
What is the difference between null and undefined?
undefined means the variable has not been assigned a variable. Null is purposefully left unassigned.
Why is it a good habit to include “labels” when you log values to the browser console?
To keep things organized and to know what and why your logging something.
Give five examples of JavaScript primitives.
boolean, number, string, null, undefined.
What data type is returned by an arithmetic operation?
A number
What is string concatenation?
Combining strings togethers.
What purpose(s) does the + plus operator serve in JavaScript?
Add two values to another.
What data type is returned by comparing two values (<, >, ===, etc)?
A boolean value.
What does the += “plus-equals” operator do?
It adds or concatenates two numbers or strings and then assigns to the variable.
What are objects used for?
Used to group together sets of variables and function(methods).
What are object properties?
They are variables describing the variable they are in.
Describe object literal notation.
variable assign with {} and key value property pairs.
How do you remove a property from an object?
use the delete keyword and the property of the object.
What are the two ways to get or update the value of a property?
using dot or bracket notation and assignment operator.
What are arrays used for?
Relevant data or lists of data.