JavaScript Functions
JavaScript Functions - Important Points
26. | What is a default parameter in JavaScript? |
---|
A. A parameter that is required for a function to work properly
B. A parameter that has a default value if no value is provided
C. A parameter that is ignored by a function
D. A parameter that is used to specify the number of times a function should be executed
View Answer Discuss Work SpaceAnswer: option b
Explanation:
27. | What is the difference between a synchronous and an asynchronous function in JavaScript? |
---|
A. Synchronous functions block the main thread of execution, while asynchronous functions do not block the main thread
B. Asynchronous functions are faster than synchronous functions
C. Synchronous functions can be called from anywhere in the code, while asynchronous functions must be called with a callback function
D. Synchronous functions can handle multiple tasks at once, while asynchronous functions can only handle one task at a time
View Answer Discuss Work SpaceAnswer: option a
Explanation:
28. | What is a callback function in JavaScript? |
---|
A. A function that is called when an event occurs
B. A function that is called at the end of a program's execution
C. A function that is passed as an argument to another function and is executed when the other function is finished
D. A function that is used to create objects
View Answer Discuss Work SpaceAnswer: option c
Explanation:
29. | What is a rest parameter in JavaScript? |
---|
A. A parameter that is required for a function to work properly
B. A parameter that has a default value if no value is provided
C. A parameter that is ignored by a function
D. A parameter that allows a function to accept an indefinite number of arguments as an array
View Answer Discuss Work SpaceAnswer: option d
Explanation:
30. | What is a spread operator in JavaScript? |
---|
A. An operator that combines two or more arrays into a single array
B. An operator that assigns a new value to a variable
C. An operator that creates a new object with a specified prototype object and properties
D. An operator that allows an iterable object to be expanded into individual elements
View Answer Discuss Work SpaceAnswer: option d
Explanation: