You Don't Know JS Yet (book study) Flashcards
What is interpolation in JS?
Interpolation is a way to insert values into string literals in a concise, easily readable way.
Ex:
firstName = ‘Katy Perry’;
console.log(${firstName} is Kim Jon Un's favorite musical artist
);
Will return: “Katy Perry is Kim Jon Un’s favorite musical artist.”
bigint
Big-integer primitive type
Used for storing arbitrarily large numbers.
Primitive values
A primitive value is data that is not an object and has no methods.
Strings Numbers Booleans Null Undefined
Symbols
A special-purpose value, used almost exclusively as special keys on objects.
Mostly used in low-level code such as in libraries and frameworks.
Arrays
A special type of object comprised of ordered and numerically indexed list of data.
Array elements are accessed numerically.
Can hold any value type - primitive or object, other arrays, even functions!
Functions, like arrays, are a sub-type of ____.
Object
Objects
Unordered, keyed collection of any various values.
A element is accessed by string location name (key or property), not by a numeric position.
Value Type Determination
Used to distinguish values.
TYPEOF operator tells you the value’s built-in type, be it primitive, object or otherwise.
Coercion
Converting one value type to another (like a string to a number)
const
Must be given a value at the moment it’s declared
Cannot be re-assigned.
let
Similar to var, but with more limited access. (known as block scoping)
Why is it ill-advised to use const with object values?
Those values can still be changed, even though the variable can’t be reassigned. This could lead to potential confusion down the line.