Here’s the question:
Create a function addFive without any arguments. This function adds 5 to the sum variable, but its returned value is undefined.
Can I please have the answer to this?
Thank you!
Your code so far
// Setup
let sum = 0;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
// Only change code above this line
function addThree() {
sum = sum + 3;
};
function addFive() {
sum = sum + 5;
};
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
first of all, you shouldn’t have changed those. you need to add those back or push the reset lesson button. Only change the code where the comment lines say to change code.
you actually typed the addFive() function correctly, but without the line: addFive();
it will never return your answer