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.
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.