Tell us what’s happening:
I’m able to complete the step. My question is why is the value undefined? When I think about it, logically, the value should be defined. So I’m probably not thinking about the guts of JavaScript correctly. What I’m looking for is the reason this is undefined so that I can understand JavaScript logic.
Your code so far
// Setup
let sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
function addFive() {
sum = sum + 5;
}
// Only change code above this line
addThree();
addFive();
Your browser information:
Challenge: Basic JavaScript - Understanding Undefined Value returned from a Function
Link to the challenge: