Else if statements syntax error

Im not sure what im doing wrong atm i have this error
SyntaxError: unknown: Unexpected token (10:14)
When i delete open curly bracket on else statement i get
You should have closing and opening curly braces for each

if else

code block.

  **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";
}

testElseIf(7);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.33

Challenge: Introducing Else If Statements

Link to the challenge:

Hello there @c.harriet.hale welcome to the FCC.
You’re missing a " { ". Your function is currently not closed. All logic should be inside the function.

Simply add a closing bracket at the end of your code before invoking the function.

Happy Coding :+1:!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.