Chapter 3 Flashcards

1
Q

what are the two roles of the … operator?

A

rest and spread

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

what are the two options in which the spread operator can be used?

A

in an array or as an argument function call
const test = […testArray];
or
testFunction(…test)

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

iterable

A

a value that can be iterated over

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

what is the iterator-consumption protocol used for?

A

consuming iterables

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

how does the iterator-consumption protocol work?

A

automatically creates an iterator instance from an iterable, and consumes just that iterator instance to its completion. This means a single iterable could be consumed more than once; each time, a new iterator instance would be created and used.

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

what is an iterator protocol?

A

a standard way to produce a sequence of values (either finite or infinite), and potentially a return value when all values have been generated.

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

how does iteration work on Maps?

A

it iterates over its entries not its values, and each entry has a value and a key

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

how can we get the index and value in an array iteration?

A

for (let [idx,val] of arr.entries()) {…}

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

default iteration

A

each type of iteration has a main or default iteration method, but also exposes other methods if different data needs to be accessed

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

in js what are the main iterator forms that are usually available on any given built-in iterables?

A
  • keys-only (keys())
  • values-only (values())
  • entries (entries())
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Closure

A

is when a function remembers and continues to access variables from outside its scope, even when the function is executed in a different scope

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

what is the difference between scope and execution context?

A

Scope is static and is comprised of the variables available at the time and location that you defined the function

The execution context is dynamic and dependent on how it is called

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

what does the call method do?

A

binds the execution context the specified object

someObject.call(someFunction)

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

what is another word of/way we reference this?

A

execution context

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

prototype chain

A

A series of objects linked together via prototypes

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

What is the purpose of prototype linkage?

A

accesses against B for properties/methods that B does not have, are delegated to A to handle.

ie. Delegation of property/method access allows two (or more!) objects to cooperate with each other to perform a task.

17
Q

How can you define an object prototype linkage?

A

you can create the object using the Object.create(..) utility

let otherHomework = Object.create(homework);

18
Q

what does Object.create(null) do?

A

creates an object that is not prototype linked anywhere, so it’s purely just a standalone object

19
Q
A