Functions Flashcards
What is an anonymous function?
An anonymous function is a function without a function name.
What is a named function?
A named function is a function with a function name.
What is an inner function?
An inner function is a function inside another function.
What is a recursive function?
A recursive function is a function that calls itself.
What is an outer function?
An outer function is a function containing another function.
What is an Immediately Invoked Function Expression?
An Immediately Invoked Function Expression is a function that is called directly after the function is loaded into the browser’s compiler.
What is the abbreviation/acronym for an Immediately Invoked Function Expression?
An Immediately Invoked Function Expression is known as an IFFE.
How can you identify an IIFE?
An IIFE can be identified by extra left & right parenthesis at the end of the function’s declaration.
The entire expression including the extra parentheses will be enclosed in another set of parentheses.
Alternatively, only the function will be enclosed in parentheses, with the extra parentheses following.
What is a First-class Function?
A programming language is said to have First-class functions when functions in that language are treated like any other variable.
In such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable.
What is a Higher-Order Function?
A Higher-Order Function is a function that returns a function.
What happens if you call the Function (capital F) constructor directly?
The Function constructor creates a new Function object. Calling the constructor directly can create functions dynamically but suffers from security & performance issues (similar to eval).
However, unlike eval, the Function constructor creates functions which execute in the global score only.