closures, recursion, axios Flashcards
1
Q
What must the return value ofmyFunctionbe if the following expression is possible ?myFunction()();
- What does this code do? const wrap = value => () => value;
A
- It would return the return of the function, which should be a function.
2
Q
- In JavaScript, when is a function’s scope determined; when it is called or when it is defined?
A
- When it is defined or lexical scope. It means it is determined where you wrote the code.
3
Q
- What allows JavaScript functions to “remember” values from their surroundings?
A
- Closures. It keeps variables in memory. Like a functions backpack, it remembers stuff from functions outer function.
4
Q
What is a closure?
A
Aclosureis the combination of a function and the lexical environment within which that function was declared.
5
Q
What are 4 JS fundamentals?
A
Closures, event loop, prototypal inheritance, this