Having a roadblock with else statements?

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.

Challenge: Introducing Else Statements

Link to the challenge:

In your else statement, you have to capitalize the s in “smaller”.

Of course, appreciate it friend. Worked just fine!

You also generally shouldn’t change code below a comment that says

// Only change code above this line

It’s fine in this case, but generally changes outside of the indicated lines makes the test suite fail.

Of course, and happy coding!

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 :slight_smile:

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.

Logging is usually safe, but some of the tests are based on console output so I thought I’d give you a heads up : )