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;
}
testElse(4);
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.
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 |