What does the return statement do?


#1


So this question is pretty straight forward, what exactly does the return statement do? I know for a fact that it stops the execution of a function, but what else? I've heard that it can do something along the lines of save a data type in a function.



#2

The return statement ends function execution and specifies a value to be returned to the function caller.

More info:
1. MDN
2. w3schools.com - JavaScript return Statement


#3

See the thing is, I don't know what "returned to the function caller" means.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.