How to make `sum` equal to 8

Tell us what’s happening:
Describe your issue in detail here.
I don’t know how to complete the second step, which is: “Once both functions have run, the sum should be equal to 8 .”

  **Your code so far**

// Setup
var sum = 0;

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

// Only change code below this line
addThree();
function addFive(sum) {
sum += 5;
}
// Only change code above this line
addThree();
addFive();
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0

Challenge: Understanding Undefined Value returned from a Function

Link to the challenge:

You’re running addThree() twice

Calling the addThree() function marked by the red arrow just before you define the addFive() function actually increments sum by 3. Remove that function call

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.