Freecodecamp: Comparison with the Inequality Operator challenge raise false error when used "99" in conditional

Created on 28 May 2016  Â·  9Comments  Â·  Source: freeCodeCamp/freeCodeCamp

Challenge Comparison with the Inequality Operator has an issue.
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36 OPR/37.0.2178.32.

My code:


// Setup
function testNotEqual(val) {
  if (val != '99') { // Change this line
    return "Not Equal";
  }
  return "Equal";
}

// Change this value to test
testNotEqual(10);

The challenge should be passed with both '99' and 99 value in the if condition test. But it only passes those who used 99. Those using '99' passes all test but reports an error saying You should use the != operator

I've uploaded an screenshot here.
screenshot from 2016-05-28 12-37-40

help wanted

Most helpful comment

If we're asking someone to use the loose equal in the challenge I don't thinks it's unreasonable for them to play around with how it actually works by using a string. I personally feel this should be fixed to allow it, since the code passes all the functionality based teats.

All 9 comments

@AnwarShah thanks for posting this issue!
As you can see here test looks for a number after != operator, that's why if fails. I understand your point but I don't know if it's worth of fixing. I'll let other @FreeCodeCamp/issue-moderators to decide what to do with this issue.


Please review the Guidelines for Contributing, thank you!.


I personally don't think this is worth fixing either.

If we're asking someone to use the loose equal in the challenge I don't thinks it's unreasonable for them to play around with how it actually works by using a string. I personally feel this should be fixed to allow it, since the code passes all the functionality based teats.

I think the test message should represent what the test actually does. So in this case, I think the test should only be checking for the != operator. The other tests are checking already checking for the correct values. Plus, I think this would be a fairly straightforward change for first-time contributors.

So in this challenge, do we just move on? I have the same input and error.

@bittamonk using just a number within the if conditional should let you pass.

Thanks. That worked. Appreciate it.

Marcellus

On Tue, Jun 7, 2016 at 10:36 AM, Eric Leung [email protected]
wrote:

@bittamonk https://github.com/bittamonk using just a number within the
if conditional should let you pass.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/FreeCodeCamp/FreeCodeCamp/issues/8833#issuecomment-224299831,
or mute the thread
https://github.com/notifications/unsubscribe/AIm9wxg9OedHtZZ54RiBdfk3UHwWIf_Uks5qJYIJgaJpZM4IpAs1
.

Marcellus Brady
Bitta Monk Entertainment

I did not use single parentheses around 99 this is my code below hope this helps.
`// Setup
function testNotEqual(val) {
if (val != 99) { // Change this line
return "Not Equal";
}
return "Equal";
}

// Change this value to test
testNotEqual(12);`

// Setup
function testNotEqual(val) {
if (val != 99) { // Change this line (note: u don't have to put 99 into ' ').
return "Not Equal";
}
return "Equal";
}

// Change this value to test
testNotEqual(10);

Was this page helpful?
0 / 5 - 0 ratings