Tell us what’s happening:
First I want to apologize for my inability to understand, thank you for you patience in advance.
I changed the code outside of the allowed lines just to see what would be the display of the result, after I used ‘console.log( )’. I did that for both of the functions, I got result 11 for function addThree() , and 13 for function addFive().
The question is: How does the code calculate these numbers, under the new conditions.
Thank You once again
Your code so far
// Setup
var sum = 0;
function addThree() {
return sum = sum + 3;
}
// Only change code below this line
function addFive() {
return sum = sum + 5;
}
// Only change code above this line
addThree();
addFive();
console.log(addThree());
console.log(addFive());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36.
Challenge: Understanding Undefined Value returned from a Function
Link to the challenge: