Inside of your functions, add 5 to the sum variable

Inside of your functions, add 5 to the sum variable
0.0 0

#1

Tell us what’s happening:

Your code so far


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

// Only change code below this line

function addFive(){
sum = 5;
sum = sum + 3;

}
var returnedValue = addFive();
// Only change code above this line
var returnedValue = addFive();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

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


#2

Make sure you read the challenge carefully. Your addFive() needs to add 5 to the sum. Don’t reset the sum variable within the addFive function. Also you can delete one of the returnedValue lines at the bottom.

Example:

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

// Only change code below this line

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

Also a good time saver is to use sum+= 5 instead of sum = sum + 5

Hope this helps