"Else" statement

is that correct??? i can’t go forward :upside_down_face:

function testElse(val) {
let result = "";
// Cambia solo el código debajo de esta línea

if (val > 5)  {
  return "Bigger than 5";
}  else  {
  return "5 or smaller";
}

// Cambia solo el código encima de esta línea
return result;
}

testElse(4);

Desafío: Introducción a las sentencias “Else”

Enlaza al desafío:

It looks like you are supposed to assign the variable result to the string literals inside the if...else rather than returning the string literals since you are returning result at the end of the function. Currently, testElse(4) returns an empty string. Correction, return result; is unreachable given the return statements in the if...else block.

5 or Smaller

The case matters here, “Smaller” not “smaller”


Edit: The challenge is set up for you to assign the value to result but you do not have to. You can return the string directly instead as you are now.

Although then there is no point in having the result variable so it should be removed but you can’t do that as that will make the test fail. So you really should just use the variable and return it.