What is the purpose of the "return" statement in a function? #10
Unanswered
ajay-dhangar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The "return" statement in a function is used to specify the value that the function should return when it is called. When the function reaches a "return" statement, it will exit immediately and return the specified value. If a function doesn't have a "return" statement, it will return "undefined" by default.
Example:
Beta Was this translation helpful? Give feedback.
All reactions