Tell us what’s happening:
Im confused on why this is passing me. How does the sum = 8?
Also, it allowed me to pass with this. How so?
var sum = 12;
function addFive() {
sum = sum + 5;
}
Your code so far
// Example
var sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
var sum = 0;
function addFive() {
sum = sum + 5;
}
// Only change code above this line
var returnedValue = addFive();
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36
.
what’s the challenge? without that is not possible to say why it is passing or not
anyway, your function return undefuned because it is not returning something else (there is not a return
statement that returns something different)
1 Like
the code running behind the scenes is why it is passing you. all they are looking for is your solution to match:
function addFive() {
sum = sum + 5;
}
you are not supposed to declare the sum variable again, but it doesn’t matter if you do because the code running behind the scenes resets the ‘sum’ variable to 0 before running the ‘addThree()’ and ‘addFive()’ functions.
1 Like
Ahh okay thanks, guess I was just overthinking it.