The exercise won't work

Tell us what’s happening:

Basic JavaScript: Introducing Else Statements has a problem. When I try to run the test, the test doesn’t run. This also happens with comparisons with logical and operator the first one. Please fix these issues as soon as possible.

Your code so far

function testElse(val) {
var result = "";
// Only change code below this line

if (val > 5) {
  result = "Bigger than 5";

} else { (val <= 5) {
  result = "5 or Smaller";

// Only change code above this line
return result;


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36.

Challenge: Introducing Else Statements

Link to the challenge:

Hi and welcome to the forum.

Your code is malformed (you have added an extra {) and this is interfering with the test suite. You also have a logical problem, as there should not be a condition for an else clause.

The error message is telling you that you have a syntax problem:

SyntaxError: unknown: Unexpected token, expected “;” (8:20)
6 | result = “Bigger than 5”;
7 |
8 | } else { (val <= 5) {
| ^
9 | result = “5 or Smaller”;
10 | }
11 |

1 Like

I just fixed that and the test still won’t run.

What is your new code? What is the new error message?

I fixed it thank you very much.

1 Like

Good work sorting it out!