Introducing Else Statements BUG HERE

Tell us what’s happening:
I think its a bug here, cause i believe i did everything right.
in console it’s working
but i cant get pass
help me to fix this

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

// Change this value to test
console.log(testElse(5));

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements/

No bug. You just have a typo in the else statement code block.

but i copied it from yours hints and still doesnt work.

Capitalization matters for what you need to return. The basic code solution hint will not pass. Copy and paste does not always work.

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

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

This is unnecessary and/or improper syntax.

1 Like