You Don't Know JS Yet (book study) Flashcards

1
Q

What is interpolation in JS?

A

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.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

bigint

A

Big-integer primitive type

Used for storing arbitrarily large numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Primitive values

A

A primitive value is data that is not an object and has no methods.

Strings 
Numbers 
Booleans 
Null 
Undefined
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Symbols

A

A special-purpose value, used almost exclusively as special keys on objects.

Mostly used in low-level code such as in libraries and frameworks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Arrays

A

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!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Functions, like arrays, are a sub-type of ____.

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Objects

A

Unordered, keyed collection of any various values.

A element is accessed by string location name (key or property), not by a numeric position.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Value Type Determination

A

Used to distinguish values.

TYPEOF operator tells you the value’s built-in type, be it primitive, object or otherwise.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Coercion

A

Converting one value type to another (like a string to a number)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

const

A

Must be given a value at the moment it’s declared

Cannot be re-assigned.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

let

A

Similar to var, but with more limited access. (known as block scoping)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is it ill-advised to use const with object values?

A

Those values can still be changed, even though the variable can’t be reassigned. This could lead to potential confusion down the line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly