Which property returns the number of arguments expected by a function?

  1. arguments.length

  2. Function.caller

  3. Function.display

  4. Function.arity


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of function properties.

Option A) arguments.length - This option is incorrect because the arguments.length property returns the number of arguments actually passed to a function, not the number of arguments expected by the function.

Option B) Function.caller - This option is incorrect because the Function.caller property returns the function that invoked the specified function, not the number of arguments expected by the function.

Option C) Function.display - This option is incorrect because the Function.display property does not exist. It is not a valid property of the Function object.

Option D) Function.arity - This option is correct because the Function.arity property returns the number of arguments expected by a function. It provides the arity, which is the number of formal parameters defined for the function.

The correct answer is D) Function.arity. This option is correct because it returns the number of arguments expected by a function.

Find more quizzes: