1.

What is the purpose of a return statement in a function?(a) Returns the value and continues executing rest of the statements, if any(b) Returns the value and stops the program(c) Returns the value and stops executing the function(d) Stops executing the function and returns the valueThis question was posed to me in exam.Question is taken from Defining and Invoking Functions in chapter Lexical Structures of JavaScript

Answer» RIGHT choice is (d) Stops executing the function and RETURNS the value

The best I can explain: The return stops the execution of the function when it is encountered within the function. It returns the value to the statement where the function is CALLED.


Discussion

No Comment Found

Related InterviewSolutions