Javascript - Return Values
📖 Read the lesson
Code Life
By Pierre Marsaa
Getting a Result Back
So far your functions print things. But often you want a function to
compute
something and return the result to you. That's what
return
does:
↗️
Loading editor...
↶
▶️ Run
↷
The call
double(
15
)
is replaced by the value the function returns: 30. You can store it, print it, or use it in a calculation.
↗️
Loading editor...
↶
▶️ Run
↷
Verify