Undefined Value returned from a Function

Tell us what’s happening:
Once both functions have ran, the sum should be equal to 8.

Your code so far


// Example
var sum = 0;
function addThree() {
sum = sum + 3;
}

// Only change code below this line

// Only change code above this line
function addFive() {
sum += 5;
}
var result = addFive();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Understanding Undefined Value returned from a Function

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function

you never call addThree

when there are lines like this you should respect them. Try resetting code and trying again.

// Only change code below this line

// Only change code above this line

Figuring out how to “call” the result I wanted was where I got hung up. Many forehead-to-desk interactions resulted. The get-help feature really didn’t help me a whole bunch on this particular exercise.

It’s great that you solved this, but we’re trying to cut back on the number of posts that are just sharing solutions. We try instead to help Campers understand and fix their code. Thanks.

Thanks, I’m fairly new here. I’ll remember that for next time.

1 Like