I'm stuck here. Please help

Tell us what’s happening:
Once both functions have run, the sum is should be equal to 8 . That’s the error I keep on getting. Not sure what Im doing wrong as I have added 5 to the function

  **Your code so far**

// Setup
let sum = 0;

function addThree() {
sum = sum + 3;

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

// Only change code above this line

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Challenge: Understanding Undefined Value returned from a Function

Link to the challenge:

1 Like

You added an extra function call, so you are adding five twice.


Thank you, let me check it out.

1 Like

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