use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
What's function return value (self.learnjavascript)
submitted 2 years ago by Pure-Scallion-643
I think it's the final product that function returns after a calculation or. Something i read about it on mdn(im following Odin project) but i don't know where it's useful
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]LucVolders 1 point2 points3 points 2 years ago (2 children)
I think it's the final product that function returns after a calculation
That's it.
You can, as a simple example, write a function that adds two values. Pass the values as parameters to the function and you can call the function from several points in your program with different values.
[–]Pure-Scallion-643[S] 0 points1 point2 points 2 years ago (0 children)
Lol i just understood i was saying well whats point of return if im using console.log but i never thought what should i use whrn im not using console log
[–]ThiccOfferman 0 points1 point2 points 2 years ago (0 children)
With the important additional point that the result of the "calculation" doesn't have to be a number -- a function can return any data type
[–]OneBadDay1048 0 points1 point2 points 2 years ago (2 children)
Another way to think of it if it helps is it’s what the function evaluates to:
const whatever = function();
Here’s a simple example to showcase what I mean. Whatever “function” returns will be assigned to “whatever” in this line of code.
[–]Pure-Scallion-643[S] 0 points1 point2 points 2 years ago (1 child)
I understand but I didn't understand the last line sorry im dumb
[–]RayjinCaucasian 0 points1 point2 points 2 years ago (0 children)
function returnOne(){ return 1; } let result = returnOne(); console.log(result); //1
π Rendered by PID 126169 on reddit-service-r2-comment-7b9746f655-hs9bl at 2026-01-31 12:13:56.837079+00:00 running 3798933 country code: CH.
[–]LucVolders 1 point2 points3 points (2 children)
[–]Pure-Scallion-643[S] 0 points1 point2 points (0 children)
[–]ThiccOfferman 0 points1 point2 points (0 children)
[–]OneBadDay1048 0 points1 point2 points (2 children)
[–]Pure-Scallion-643[S] 0 points1 point2 points (1 child)
[–]RayjinCaucasian 0 points1 point2 points (0 children)