Weak Areas Flashcards

(3 cards)

1
Q

What is a closure in JavaScript?

A

A closure is when a function remembers and can access variables from its outer scope even after that outer function has finished executing.

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

What is memoization used for?

A

Memoization is used to speed up functions by caching the results of expensive function calls and returning the cached result when the same input occurs again.

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

How does memoization typically use closures?

A

Memoization uses closures to maintain a private cache object that persists across calls to the memoized function.

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