Javascript-closures Flashcards
1
Q
What must the return value of myFunction be if the following expression is possible?
myFunction()();
A
return another function.
2
Q
What does this code do? const wrap = value => () => value;
A
function that takes single param, and then there is a function that takes no params, and it returns the outter params.
3
Q
In JavaScript, when is a function’s scope determined; when it is called or when it is defined?
A
when the function is defined.
4
Q
What allows JavaScript functions to “remember” values from their surroundings?
A
closures