Home »
MCQs »
JavaScript MCQs
Which is the correct syntax for the function definition?
44. Which is the correct syntax for the function definition?
- return_type function function_name(parameter1, parameter2, ...) { /*Function's body*/ }
- function function_name(parameter1, parameter2, ...) { /*Function's body*/ }
- return_type function_name(parameter1, parameter2, ...) { /*Function's body*/ }
- function function_name(parameter1, parameter2, ...) as return_type { /*Function's body*/ }
Answer: B) function function_name(parameter1, parameter2, ...) { /*Function's body*/ }
Explanation:
The function definition syntax is:
function function_name(parameter1, parameter2, ...)
{
/*Function's body*/
}