19.
What is the purpose of the length property of a JavaScript function?
It returns the number of characters in the string passed as an argument to the function.
It returns the number of elements in the array passed as an argument to the function.
It returns the number of properties defined within the function.
It returns the number of parameters expected by the function.
Correct: D
The length property of a JavaScript function returns the number of parameters expected by the function. This property can be used to dynamically check the number of parameters passed to a function and perform different actions based on that information.
function myFunction(name, age) {
// ...
}
const functionLength = myFunction.length;
console.log(functionLength); // Output: 2