JavaScript Flashcards
What is the purpose of variables?
To remember data for future reference.
How do you declare a variable?
Write down keyword (var) to declare that variable.
How do you initialize (assign a value to) a variable?
By using a single = sign, (= meaning assignment).
What characters are allowed in variable names?
Letters, $, _ anywhere and numbers ,but number needs to be at the end.
What does it mean to say that variable names are “case sensitive”?
JavaScript does not consider lowercase and uppercase the same.
What is the purpose of a string?
A way to hold a sequence of characters represented with letter characters.
What is the purpose of a number?
To store numbers for calculation.
What is the purpose of a boolean?
It allows us to render what is or isn’t.
What does the = operator mean in JavaScript?
To assign a thing.
How do you update the value of a variable?
No keyword is necessary.
What is the difference between null and undefined?
Null can only be assigned and not generated by JavaScript, undefined comes from JavaScript.
Why is it a good habit to include “labels” when you log values to the browser console?
To know what you are looking at specifically.
Give five examples of JavaScript primitives.
String, number, boolean, null, and undefined.
What data type is returned by an arithmetic operation?
A number.
What is string concatenation?
Any type of values being added to a string which results in one string.
What purpose(s) does the + “plus” operator serve in JavaScript?
It can concatenate or be used for addition.
What data type is returned by comparing two values (<, >, ===, etc)?
Boolean
What does the += “plus-equals” operator do?
It adds the value to the variable and assigns that result to the variable.
What are objects used for?
To group together a set of properties, variables and functions to give it grouping in one location.
What are object properties?
The piece of data represented by the key and value.
Describe object literal notation?
The data inside the {} for example: properties or key and values.
How do you remove a property from an object?
With the delete operator and . name of the property
What are the two ways to get or update the value of a property?
You can use dot notation or bracket notation.
What are arrays used for?
Good for rendering a list of data of any length and where the order is important or unimportant.