I cant run the test :( (half solved)

Tell us what’s happening:
I cant run the tests in this one, every time i write a line, the console shows an error, and the “run the tests” button doesn’t work :frowning:

Your code so far

function testElseIf(val) {
if (val > 10) {
  return "Greater than 10";

else if (val < 5) {
  return "Smaller than 5";
} else {

return "Between 5 and 10";

// Change this value to test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36.

Challenge: Introducing Else If Statements

Link to the challenge:

1 Like

Did you try deleting line 15 and whatever is on it? It looks like something is there that is confusing the console.

1 Like

Yeah, i tried, but the error passes to the next line

1 Like

nevermind, i didn’t notice that there is an open bracket in my code, i closed it, and now it works…

but, i still don’t know why the “run the test” button didn’t work :confused:

1 Like

In a lot of ways, computers are extremely stupid. Leaving the bracket open can be enough to confuse it so it doesn’t know what to do or how to run tests.

1 Like

the Run the test button didn’t work, because it doesn’t know what to do with malformed javascript code. It may have been that it tried to run your function, but because it wasn’t closed it causes a fatal error internally.

If you were to open the developer’s console (F12 on most browsers, but a pretty advanced topic), you’d see the error show up in there, saying something along the lines of “missing }”.