SyntaxError: Unexpected token { in line no 10

The code is correct but i am geting an error of statement.

SyntaxError: Unexpected token { at line no 10

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

// Change this value to test
testElse(4);

i solved it. it was my mistake.

I think it is because you have a condition in the else statement and it should not have one.

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

Thanks guys for the help