Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements

Tell us what’s happening:

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

testElse(4);

The above is my answer.
There must be a bug, i even tried to copy past the answer from the forum into the box but it still comes back with:
// running tests

testElse(4)

should return “5 or Smaller”

testElse(5)

should return “5 or Smaller” // tests completed

Your code so far


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

testElse(4);

Your browser information:

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

Challenge: Introducing Else Statements

Link to the challenge:

Hi and welcome to the forum!

You changed the output from the given. S should be capitalizated.

1 Like

It’s not a bug, it’s a typo :grinning:

"5 or smaller" is what your function returns.
"5 or Smaller" is what the challenge wants you to return.

1 Like

LOL, sorry getting late… :joy:
Thanks a lot…

1 Like