I don’t understand this challenge very well, can someone please explain what this is about and help me fix the error Once both functions have ran, the sum should be equal to 8.
Your code so far
// Setup
var sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
var sum = 0;
function addFive() {
sum + 5;
}
addFive(3);
// Only change code above this line
addThree();
addFive();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36.
Challenge: Understanding Undefined Value returned from a Function
undefined value is a condition where an expression does not have a correct value, although it is syntactically correct. An undefined value must not be confused with empty string, boolean “false” or other “empty” values.
You just have to write the function . Your function addFive doesn’t have any parameter then why are you passing parameter when you are calling Just complete the addFive function.
function addThree() {
sum = sum + 3;
}
// Only change code below this line
addThree();
console.log(sum, "<= sum")
function addFive() {
sum += 5;
}
var returnValue = addFive();
// Only change code above this line
console.log(sum, "<= sum");