Tell us what’s happening:
Hi
So I got this right but I think I need to clarify some points so I that I understand the why and if.
In my code I should use a return but I was playing around. When I takeaway addThree( )or addFive( ) I get undefined or nine.
So the value nine when I put 1 in the parameter if the first function gives me nine so both function are working.
Are addThree( ) and addFive( ) calling the function to run?
When I log either function I still get the value undefined if I log addThree or 9 if I use a return and addFive. Why are they logging different and c should I not just get the output of the value I log?
Thanks in advance.
Your code so far
// Setup
var sum = 1;
function addThree() {
sum = sum + 3;
}
// Only change code below this line
// Only change code above this line
addThree();
addFive();
function addFive() {
return sum +5
}
console.log(addFive())
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Edg/88.0.705.56
.
Challenge: Understanding Undefined Value returned from a Function
Link to the challenge: