Can someone please help me understand

Basic JavaScript: Understanding Undefined Value returned from a Function:

my code only part works:

function addFive(){
sum +=5;
}
var result = addFive();

function addThree(){
sum = sum + 3;
}
var result = addThree();

I find Js quite complicated at times, just trying to get to grips with how things work.
many thanks

@lukeMersh
what’s the challenge link?

I think the point here that your functions can do something even if they do not return anything (they do not have a return statement so they return undefined by default) but still can change variables and stuff

I am stuck with the coding on this…
I think i am stuck on this part:

Once both functions have ran, the sum should be equal to 8.

have you maybe removed the definition of the sum variable?

please give the challenge link

Here is the challenge: " Create a function addFive without any arguments. This function adds 5 to the sum variable, but its returned value is undefined ."

and where is the declaration of the sum variable? have you maybe removed it?

please, provide the challenge link, so I know what’s the starting code

fixed it :smiley:
i removed the :var result = addFive();
happy days