Tell us what’s happening:
how doe it get 8 when
var sum = 0;
sum += 5;
?
Your code so far
// Setup
var sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
function addFive(){
sum += 5;
}
// 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.129 Safari/537.36.
Challenge: Understanding Undefined Value returned from a Function
okey but why do i need to have
addThree() before addFive()
can i just make it var sum = 3 and then sum +=5 and its joining to be 8 that’s the part that is confusing me
Of course, you can do exactly that, however you need to follow what the challenge instructions said or you won’t pass the challenge. I know, it’s very picky.