Tell us what’s happening:
Don’t understand why this is not working when I test for 4 or 5.
function testElse(val) {
var result = "";
// Only change code below this line
if (val > 5) {
result = "Bigger than 5";
} else {
result = "5 or smaller";
}
// Only change code above this line
return result;
}
// Change this value to test
testElse(4);
Your code so far
function testElse(val) {
var result = "";
// Only change code below this line
if (val > 5) {
result = "Bigger than 5";
} else {
result = "5 or smaller";
}
// Only change code above this line
return result;
}
// Change this value to test
testElse(4);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52
.
Challenge: Introducing Else Statements
Link to the challenge: