Tell us what’s happening:
I believe my syntax to be correct but maybe i’m missing something that someone else can catch that I couldn’t. I’m trying to pass the introducing else statements challenge and seem to have hit a roadblock. I typed in the following code and even tested the output by logging the result into the console. By doing so I have gotten the correct answer but can’t seem to pass the run test. Any ideas? Did I type something somewhere I shouldn’t?
I’ve tried the hint solution to see if I was missing anything and It seems to match. Hope it’s not something super obvious and I look like a complete dummy! cheers.
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;
}
testElse(4);
console.log(testElse(0))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36.
I’ve spent hours before trying to fix broken code , only to realize it’s a tiny error like that.
It’s super common and all a part of the debugging process
In my experience through these challenges I haven’t had a problem console logging below the line for quite some time. I just considered logging a test variable or function shouldn’t do that much damage and I could just delete it once I was finished using it. I’ll keep this in mind.