holds a value, but unlike a variable, the value can't change after initialization
Back
How do you initialize a date to a specific date?
Front
const halloween = new Date(2016, 9, 31);
Back
How do you initialize a date to the current date or time?
Front
const now = new Date();
now;
Back
What are the naming rules for identifiers?
Front
1. must start with a letter, dollar sign ($), or underscore (_)
2. consist of letters, numbers, the dollar sign ($), & underscore (_)
3. unicode characters are allowed
4. cannot be a reserved word
Back
What is the advantage of using parseInt?
Front
it allows you to specify a radix which is the base with which you want to parse the number, such as specifying base 16 to parse hexadecimal numbers
Back
What is a map?
Front
map keys to values (like objects) but offer some advantages in certain situations
also can't contain duplicates
Back
How do you convert to a string?
Front
the toString method
Back
What are identifiers?
Front
variable, constant, & function names
Back
What character is used to escape strings?
Front
backslash
Back
What is the naming convention for constants?
Front
It is conventional (but not required) for constants that refer to specific number or string to be named with all uppercase letters and underscores
Back
What are regular expressions?
Front
a common language extension that represents a compact way to perform complex search & replace operations on strings
Back
Can an object contain a function as one of its properties?
Front
yes
Back
What's the literal syntax of an object?
Front
curly braces {}
Back
What special 3 values result in numeric values that are not numeric literals?
Front
1. NaN
2. negative infinity
3. infinity
Back
When do you always want to use a variable and not a constant?
Front
loop control
Back
What is variable declaration?
Front
creating a variable with var, let, or const
Back
How do primitives and objects differ?
Front
primitive types are immutable while objects can take on different forms and values
Back
Booleans evaluate to what two values?
Front
true & false
Back
If you don't provide an initial value for a variable when you declare it, what special value does it get?
Front
undefined
Back
What does JSON stand for?
Front
JavaScript Object Notation
Back
What format does JavaScript use to approximate real numbers?
Front
double (double-precision floating-point)
Back
What's the difference between null & undefined?
Front
null is a data type available to you the programmer
undefined should be reserved for JS itself (best practice, but not a rule)
Back
How do you declare multiple variables with the same let statement?
Front
use commas,
e.g.
let var1, var2 = "example_value", var2 = "second_example_value"
Back
How can strings be converted to numbers?
Front
1.
const numStr = "33.3";
const num = Number(numStr);
2.
use the built-in parseInt or parseFloat
Back
What makes arrays special (vs regular objects)?
Front
array contents have a natural order (element 0 will always come before element 1), & keys are numeric & sequential
Back
What are symbols?
Front
a data type representing unique tokens, similar to objects in that each is unique
Back
What is the advantage of using a constant (vs a variable)?
Front
It makes it harder to accidentally change the values of things that shouldn't be changed
Back
What are the contents of an object called?
Front
properties (or members)
Back
What is Number.EPSILON?
Front
smallest number that can be added to 1 to get a distinct number
Back
How do sets differ from arrays?
Front
sets cannot contain duplicates
Back
What is a trailing comma?
Front
a comma at the end of multiple elements spanning multiple lines inside an array or object
Back
What is a string template?
Front
provides a shorthand way of injecting values into a string
e.g. `The current temperature is ${currentTemp} \u00b0C`
Back
What's another name for a string template?
Front
string interpolation
Back
What are the built-in object types (mentioned in this chapter)?
Front
1. array
2. date
3. regexp
4. map / weakmap
5. set / weakset
Back
When do you use the computed member access operator?
Front
when you want property names that are not valid identifiers,
e.g.
obj["not an identifier"] = 3;
Back
Are array elements required to have the same type?
Front
no, they are not homogenous
Back
How would you get the first element of this array called "arr": ['a', 'b', 'c'] ?
Front
arr[0]
Back
What do strings represent in JavaScript?
Front
unicode text
Back
How do you convert to boolean?
Front
use the not operator (!) twice
Back
What is a variable?
Front
named value that chan change at any time
Back
What do properties consist of?
Front
1. name (key)
2. value
Back
What is a literal?
Front
means that you're providing the value directly to the program; JavaScript takes the literal value you provide and creates a data value from it
Back
What does camel case refer to?
Front
convention for naming JavaScript identifier that starts with lower case and capitalizes following words: "camelCase"
Back
What 4 types of numeric literal does JavaScript recognize?
Front
1. decimal
2. binary
3. octal
4. hexadecimal
Back
What are the 6 primitive types?
Front
1. number
2. string
3. boolean
4. null
5. undefined
6. symbol