Anonymous
Not logged in
Talk
Contributions
Create account
Log in
WikiKnowledgeBase
Search
Editing
Technology/Software Development/General knowledge/Programming Fundamentals/Functions
(section)
From WikiKnowledgeBase
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Return Values == '''Definition''' Functions can return a value after performing their task. The return statement is used to specify the value to be returned. '''Code Example''' Here's an example in JavaScript that demonstrates a function with a return value: <pre> // Function declaration function square(number) { return number * number; } // Function execution and output let result = square(5); console.log(result); // Output: 25 </pre> In this example, the `square` function takes a parameter `number` and returns the square of that number. When the function is executed with the argument `5`, it returns `25`, which is then assigned to the `result` variable and printed to the console.
Summary:
Please note that all contributions to WikiKnowledgeBase may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Random page
Categories
Help about MediaWiki
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs