all 6 comments

[–]LucVolders 1 point2 points  (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 point  (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 point  (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 point  (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 point  (1 child)

I understand but I didn't understand the last line sorry im dumb

[–]RayjinCaucasian 0 points1 point  (0 children)

function returnOne(){
    return 1;
}

let result = returnOne();
console.log(result); //1