What is the purpose of the `return` statement in a function?

JavaScript Associate Easy

JavaScript Associate — Easy

What is the purpose of the `return` statement in a function?

Key points

  • `return` exits the function
  • It can specify a value to be returned
  • Helps pass data back to the caller
  • Essential for functions to produce output

Ready to go further?

Related questions