Tell us what’s happening:
Describe your issue in detail here.
Your code so far
// Setup
let sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
function addFive() {
sum += 5;
}
var result = addFive();
// 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/114.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Understanding Undefined Value returned from a Function
Just in case it is clear what I was suggesting you do.
// Setup
let sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
function addFive() {
sum += 5;
}
// do not call addFive() here
// both functions should only be called one time
// var result = addFive();
// Only change code above this line
// If you want to see the result of calling the functions
// capture the return value here
var result = addFive();
console.log(result); // undefined
// or wrap the function calls inside a log
console.log(addThree()); // undefined