Functions Flashcards

1
Q

What is an anonymous function?

A

An anonymous function is a function without a function name.

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

What is a named function?

A

A named function is a function with a function name.

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

What is an inner function?

A

An inner function is a function inside another function.

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

What is a recursive function?

A

A recursive function is a function that calls itself.

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

What is an outer function?

A

An outer function is a function containing another function.

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

What is an Immediately Invoked Function Expression?

A

An Immediately Invoked Function Expression is a function that is called directly after the function is loaded into the browser’s compiler.

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

What is the abbreviation/acronym for an Immediately Invoked Function Expression?

A

An Immediately Invoked Function Expression is known as an IFFE.

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

How can you identify an IIFE?

A

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.

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

What is a First-class Function?

A

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.

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

What is a Higher-Order Function?

A

A Higher-Order Function is a function that returns a function.

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

What happens if you call the Function (capital F) constructor directly?

A

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.

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