What does the return statement do in a JavaScript function?

  • Returns a value from the function and exits the function
  • Declares a variable
  • Creates a loop
  • Includes a comment in the code
The return statement in a JavaScript function is used to return a value from the function and immediately exit the function. It is used to send data back to the caller of the function. The other options do not describe the purpose of the return statement.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *