Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
Returning a function from another function
Using the "with" statement
Using the "debugger" statement
Using the "switch" statement
A function that is called when an event occurs
A function that is called at the end of a program's execution
A function that is passed as an argument to another function and is executed when the other function is finished
A function that is used to create objects
What is the output of the following code snippet?
function myFunction(x) {x = x + 1;return x;}var y = 2;myFunction(y);console.log(y);
2
3
undefined
Error
function myFunction(x, y) {console.log(x + y);}myFunction(2, 3, 4);
5
9
11
function myFunction(x) {return function(y) {return x + y;};}var addFive = myFunction(5);var result = addFive(10);console.log(result);
10
15
20
To create a new variable
To create a new object instance
To declare a new function
To import a module
To specify a function's input parameters
To declare variables inside a function
To specify a function's name
To return a value from a function
A function that returns a boolean value
A function that takes another function as an argument or returns a function as a result
A function that performs a specific task
static
prototype
class
function
To pass values into a function
To define a function's name
To specify a function's return value