Please help me, why Under >10 , i see input under

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function testGreaterThan(val) {
if (val >100) {  // Change this line
  return "Over 100";

if (val >10) {  // Change this line
  return "Over 10";

return "10 or Under";

  **Your browser information:**

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

Challenge: Comparison with the Greater Than Operator

Link to the challenge:

I’m not sure what you mean. Can you please elaborate?

I do not understand how to check the result, it seems to me that it outputs the value = Under

Your code is correct and will pass the tests if you click on “Run the tests”.

Maybe you are confused about why there is return "10 or Under"; under the rest of the code without any conditionals and checks. The reason is that if the code execution reaches this last line of the code, we can be sure that val is equal to or less than 10, otherwise one of the previous conditionals would have turned true and the code had returned early.

By writing:

console.log( testGreaterThan(10) );

Yes, good, thanks, I figured it out a little bit

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