javascript-closures Flashcards

1
Q

What must the return value of myFunction be if the following expression is possible?
myFunction( )( );

A

the return value of the function inside of myFunction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
What does this code do?
const wrap = value => ( ) => value;
A

the wrap is being assigned to an anonymous function taking one parameter value which returns another anonymous function with no parameters that returns value

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

In JavaScript, when is a function’s scope determined; when it is called or when it is defined?

A

when it is defined

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

What allows JavaScript functions to “remember” values from their surroundings?

A

closures

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