Functions JS fill in the blank Flashcards
(93 cards)
A function in JavaScript is a block of code that is defined once and can be executed many times when it is ____ or ____.
invoked, called
Functions in JavaScript can be categorized into several types such as named, anonymous, and ____ functions, as well as ____ functions.
recursive, IIFEs
Closures are important in JavaScript because they establish context for code execution and are key to ____ programming and ____ functions.
asynchronous, generator
In JavaScript, functions can be treated as values and can be passed to other functions or ____ from other functions, demonstrating their ____ nature.
returned, first-class
To change the value of the ‘this’ keyword in JavaScript, you can use methods like apply, call, and ____. These methods are essential for ____ functions.
bind, higher order
When defining a function in JavaScript, it can be done as a declaration or an ____, and it is invoked using ____.
expression, parentheses
Higher order functions in JavaScript can receive functions as arguments or ____ functions, showcasing their flexibility and ____ capabilities.
return, functional
Generator functions and iterators in JavaScript are used for ____ over values, making them essential for ____ programming.
iterating, asynchronous
The main types of functions in JavaScript include named, anonymous, recursive, inner, outer, and ____. Each serves a different ____ in programming.
IIFEs, purpose
In JavaScript, a function is defined using the ____ keyword followed by the ____ name.
function, function
The executable code block of a function is contained within ____ braces and may return a value using the ____ keyword.
curly, return
To invoke a function in JavaScript, you must use ____ after the function name and can pass values by including them in the ____ .
parentheses, parentheses
Functions in JavaScript can be treated as ____ because they can be passed around like ____ values.
values, primitive
When defining a function, the function name is followed by parentheses which can include ____ to be passed into the function.
arguments
The ‘sum’ function takes two parameters, ____ and ____, and returns their ____ .
num1, num2, sum
To change the context of a function, you can use methods like ____, ____, or ____ .
call, apply, bind
In JavaScript, the most common way to define a function is through a function ____ .
declaration
The return value of a function can be captured in a variable by assigning it to a ____ .
let, const, var
The output of the ‘sum’ function when called with 20 and 30 is ____ .
50
A function can be ____ to a variable similar to a ____ value.
assigned, primitive
A function can be stored in an ____ similar to a ____ value.
array, primitive
A function can be passed to another function as an ____ and may also be ____ from a function.
argument, returned
In JavaScript, functions are treated like any other ____ because they are first class ____.
value, functions
A named function is created by providing a name after the function ____ keyword.
declaration, function