testElse(4) should return the string 5 or Smaller

Tell us what’s happening: why it doesnt work?

  **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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36.

Challenge: Introducing Else Statements

Link to the challenge:

Hi. Your code looks correct. When I put input your code line-for-line as is in Chrome it passes yet if I copy your code and paste it in it gives syntax errors for the quotation marks and lettering in your code. Try making sure that any extensions that you have are turned off, or if you are not in Chrome, try working in Chrome. Hope this helps.

Can you see in the syntax highlighting how this looks a little funny? The quotations marks should be "" instead of “”. Some devices (particularly Apple devices) like to autocorrect quotation marks to the ‘wrong’ ones for coding.

Edit: This doesn’t have anything to do with a particular browser or browser extensions.

i m in chrome i have adblock extentsion do you think its bcs of adblock?

No. It has nothing to do with your extensions. Your quotation marks are the wrong type of quotation marks.

its not my quotesion
this is correct solution i passed this lesson now:

// Only change code below this line

if (val > 5) {

result = "Bigger than 5";

} else {

result = "5 or Smaller";

}

If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

1 Like

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