Feedback for: "Comparisons with the Logical Or Operator"

Hello, I notice a few other support topics on this particular challenge so I’d like to bring something to the attention of the FCC staff. I think the Instructions need a small tweak.

This line specifically:

…if val is not between 10 and 20, inclusive.

The word inclusive threw me off when I was working on it. I interpreted that to mean including 10 and 20, but if we do that the tests fail.

This includes 10 and 20:

if (val <= 10 || val >= 20) {
    return "Outside";

This excludes 10 and 20:

if (val < 10 || val > 20) {
    return "Outside";

The tests pass with the latter but the Instructions call for inclusion.

I don’t need any support. It is ok to close this. I am moving on with the course, but I want to let someone at FCC know about it.

How would you word it to make it more clear for others?

The instructions are correct. “…not between 10 and 20, inclusive” means “The number is not within the range of numbers from 10 to 20, inclusive”.

Hi Randell,
I’m not a word-smith but maybe something like this, depending on the expected outcome:

If you want 10 and 20 to be included:

Combine the two if statements into one statement which returns “Outside” if val is not between 10 and 20, but can equal 10 or 20. Otherwise, return “Inside”.

If you don’t want 10 and 20 to be included:

Combine the two if statements into one statement which returns “Outside” if val is not between 10 and 20, and does not equal 10 or 20. Otherwise, return “Inside”.

PortableStick, and I’m ok with that but I interpreted it differently and I’m sure others have too. Inclusive can mean two different things in this situation. Include 10 and 20 or only include the range of numbers.

I understand the confusion. As often happens, simple is better. And the wording

would have been clearer with the “inclusive” part excluded:

I can appreciate that there can be many interpretations for those unfamiliar with the way math concepts are expressed in language, and I don’t mean to simply dismiss your feedback, nor do I have any authority over this matter, but there’s a good reason why it is the way it is. My point is that the wording is not a stylistic choice on the part of the challenge’s author, but simply the way that this sort of parameter is normally described in mathematics. The use of “inclusive”, as well as “exclusive”, is normal and not uncommon in these sorts of algorithm challenges. Even if we were to make accommodations in the FreeCodeCamp curriculum, you’d run into the exact same phrasing somewhere else. Problem is, the curriculum is meant to prepare you for interviews and other challenges. You may be somewhat frustrated by the challenge’s wording now, but imagine having gone through all of the certifications - months of hard work - and then being confounded by the same wording during an interview because you had never seen it before.


excellent response, PS. Makes sense.

I just ran across this in “Generate Random Fractions with JavaScript.”

‘…a random decimal number between 0 (inclusive) and not quite up to 1 (exclusive).’

So it turns out that the usage of inclusive is not consistent. This time, it includes the number in question: "0’.

This would in fact produce 0:

When it says “between 0 (inclusive)”, that means 0 is one of the possible return values. When it says “not quite up to 1 (exclusive)”, that means it will not include 1 as a possible return value. No inconsistencies here.

These questions seem to be avoiding the most logical language, presumably because someone thought it would ‘give the game away’ ie;

The first one could be written: "if val is less than 10 or greater than 20"
and the second: “a random decimal number greater-than or equal to 0 and less than 1”

no inconsistency with that challenge. I am referring to it being inconsistent with the first challenge I started the thread with: “Comparisons with the Logical Or Operator”

In that challenge 10 and 20 are not included, when it uses the word inclusive.

In “Generate Random Fractions with JavaScript” 0 is included when using the word inclusive.

I found another one in “Generate Random Whole Numbers within a Range.” The word inclusive is used to mean that the parameters “myMin” and “myMax” are included.

I won’t point out any more. I don’t want to come across as a jerk. Just wanted to bring it up so it was known. Thanks for the guidance. : )

Actually, the MDN documentation states:

The Math.random() function returns a floating-point, pseudo-random number in the range from 0 inclusive up to but not including 1 — which you can then scale to your desired range.

So, the use of the word inclusive was not arbitrary.

What you’re missing with the first one, I think, is that 10 are 20 are included in the range that you should be outside. So you need to be outside the range inclusive of 10 and 20. It’s technically correct.

In the phrase “if val is not between 10 and 20, inclusive.” the word “not” is before the between. The word inclusive is preceded by 10 and 20 and a comma. These means 10 and 20 are included with the between reference, but the word “not” changes the meaning to not include the 10 and 20.

Kind of like when I write:

var myReasoning = true;

and then put a ! in front of myReasoning like:

var negate = !myReasoning; // negate is false
1 Like

So, the wording was chosen to match the wording there? The wording “and not quite up to 1” is still a potentially confusing and imprecise when you could just write “and less than 1”.

And I interpret that differently. The word “not” is only referring to “not between.” I don’t see how the word “not” is referring to “not including 10 and 20.” I think that is point actually. It’s ambiguous. I think we should consider people who speak English as a second language as well.

@r1chard5mith - I didn’t write the MDN documentation.

When I first looked at the documentation and the wording of this challenge, I had to read it a couple of times before I “got it” too. Though it could have been written many different ways, I still think the wording is fine and makes you really think about what is being asked to pass the challenge.

“between 10 and 20, inclusive” means including 10 and 20. Put “not” in front of this phrase, and you get "does not include 10 and 20).

As long as you now understand what the challenge instructions were trying to do and you have successfully passed this challenge, then I think you have learned all that was intended.

I’m surprised to learn that you didn’t write the MDN documentation. Thanks for clearing that up.

I still think the wording could be clearer and you started by asking “How would you word it to make it more clear for others?”. I don’t see any reason not to make it as clear as possible.

Just to be clear, imo “up to but not including 1” is fine, whereas “not quite up to 1” is mathematically meaningless without further clarification.