Freecodecamp: Mistake

Created on 8 Oct 2016  路  5Comments  路  Source: freeCodeCamp/freeCodeCamp

It should be <10 and >5.

Challenge Comparisons with the Logical Or Operator has an issue.
User Agent is: Mozilla/5.0 (iPad; CPU OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A456 Safari/602.1.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function testLogicalOr(val) {
  // Only change code below this line

  if (val) {
    return "Outside";
  }

  if (val) {
    return "Outside";
  }

  // Only change code above this line
  return "Inside";
}

// Change this value to test
testLogicalOr(15);

Most helpful comment

I am not sure if this is talking about the problem itself or the example text. The example text is:

will return "Yes" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:

if (num > 10 || num < 5) {
  return "No";
}
return "Yes";

Which is certainly correct.

The problem Instructions don't even deal with 5 and 10 but rather 10 and 20 so maybe there is a confusion between the example and the instructions for the problem.

All 5 comments

I am not sure if this is talking about the problem itself or the example text. The example text is:

will return "Yes" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:

if (num > 10 || num < 5) {
  return "No";
}
return "Yes";

Which is certainly correct.

The problem Instructions don't even deal with 5 and 10 but rather 10 and 20 so maybe there is a confusion between the example and the instructions for the problem.

The instructions read correctly to me as well as the statement returns "No" if < 5 or > 10.

@marienhof can you elaborate on what the issue is?

screenshot at 2016-10-08 10 29 42

I think here comes confusion on the first sight.

if (num > 10) {
return "No";
}
if (num < 5) {
return "No";
}
return "Yes";
if(num < 5 || num > 10) will return "No", else will return "Yes"

Example says only numbers that are between 2 if's will return "Yes" string.
Numbers [6,7,8,9] will return yes.

@marienhof I think you mean that it need to be >5 && <10 so it would return [6,7,8,9] numbers in between which is true but not used in this example.

Example of what is bugging...

if(num < 10){
return "Yes";
}
if(num > 5){
return "Yes";
}
return "No";
if(num > 5 && num < 10) will return "Yes", else will return "No"

Closing as stale.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bagrounds picture bagrounds  路  3Comments

jurijuri picture jurijuri  路  3Comments

raisedadead picture raisedadead  路  3Comments

Tzahile picture Tzahile  路  3Comments

DaphnisM picture DaphnisM  路  3Comments