The return statement causes the function to exit immediately and return the value of the expression in the return statement.
return 5;
This causes the function to exit and return the number 5. In your function processArg, the return statement will evaluate the expression (num + 3) / 5 and then return the value of that expression.
processed = processArg(7);
This means the return statement is:
return (7+3) / 5;
So the function will return the value 2 and the variable processed will be set to the returned value.
‘return’ is a JavaScript keyword that tells the function what to send back to you. And once it’s sent something back to you, it know to stop running that function.
You put things into a function. And you want the function to send something different back to you. ‘return’ is how it knows what you want sent back out of the function. And once the system encounters the ‘return’ keyword, it’ll send you what you asked for, and then it will stop running the function.