Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

=== is not opposite of !== #11763

Closed
Tanvir-rahman opened this issue Nov 22, 2016 · 13 comments
Closed

=== is not opposite of !== #11763

Tanvir-rahman opened this issue Nov 22, 2016 · 13 comments

Comments

@Tanvir-rahman
Copy link

@Tanvir-rahman Tanvir-rahman commented Nov 22, 2016

Challenge Name

https://www.freecodecamp.com/challenges/comparison-with-the-strict-inequality-operator

Issue Description

Actually !== is not the opposite of the strict equality operator. === means equal value AND equal type. !== means not equal value Or not equal type.That means if one condition is true then the expression will return true.But for strict equality operator both condition must be true.I think these information should be provided.

Browser Information

  • Browser Name, Version: Google Chrome,54.0.2840.99 m (64-bit)
  • Operating System: Windows 10
  • Mobile, Desktop, or Tablet: Desktop
@dhcodes
Copy link
Contributor

@dhcodes dhcodes commented Nov 22, 2016

It's not equal value and/or not equal type. See here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators

I thinks the sentiment is still correct. But others can weigh in.

@Bouncey
Copy link
Member

@Bouncey Bouncey commented Nov 22, 2016

We could re-write the instructions to reflect the and/or nature of !==

Operand 1 Operand 2 State
'One String' 'Another String' true
1 2 true
1 '1' true
4 4 false
'String' 'String' false
@dhcodes
Copy link
Contributor

@dhcodes dhcodes commented Nov 22, 2016

@Bouncey but isn't !== the accepted opposite of ===? Or is there an alternative that I'm not aware of?

@Bouncey
Copy link
Member

@Bouncey Bouncey commented Nov 22, 2016

@dhcodes it is and it sort-of isn't

The issue is with this line in our challenge instructions

The strict inequality operator (!==) is the opposite of the strict equality operator.

Where the strict equality operator requires both type AND value to be equal to resolve as true, the strict inequality operator requires either the type OR the value to be different to resolve as true.

Describing it as the 'opposite' implys the type and value need to differ to reslove as true

We could reword the instructions to reflect the difference of the strict inequality operator

@robbawebba
Copy link
Contributor

@robbawebba robbawebba commented Nov 22, 2016

From a logic perspective, I think !== is the logical opposite of ===:
Assuming === can be written as Operand1 AND Operand2, then the opposite would be NOT(Operand1 AND Operand2). This can be written as NOT(Operand1) OR NOT(Operand2), which is the same as !==. However, I can see where the ambiguity is in the instructions and why that can be confusing.

@systimotic
Copy link
Member

@systimotic systimotic commented Nov 22, 2016

I agree with @dhcodes and @robbawebba. While I was writing out my argumentation, Rob did a much better job. The only exception is NaN, which is not equal to itself.
I was writing a Codepen to assert (pun intended) my assumptions. In case anyone prefers code examples, here's my mess: http://codepen.io/Timoh/pen/ZBKBdL?editors=0012

@dhcodes
Copy link
Contributor

@dhcodes dhcodes commented Nov 22, 2016

I'm not opposed to changing it; I am just unsure what rewrite would accomplish this without making it more confusing for the camper. Thanks for the example @systimotic.

@Jeff-Shapiro
Copy link

@Jeff-Shapiro Jeff-Shapiro commented Nov 22, 2016

information removed

No longer contributing

@Tanvir-rahman
Copy link
Author

@Tanvir-rahman Tanvir-rahman commented Nov 23, 2016

I observed a lot of my friends do mistake in this logic.In most places people say !== is opposite of ===.So they assume the name of !== will be Not Equal value And Equal Type. as === is called Equal Value and Equal Type. Also in most cases learners are beginner so i think at least the name should be mentioned. It's just my suggestion.
http://www.w3schools.com/js/js_operators.asp

@dhcodes
Copy link
Contributor

@dhcodes dhcodes commented Nov 23, 2016

I possibly like the idea of adding the word 'logical' as in:

The strict inequality operator (!==) is the logical opposite of the strict equality operator.

And then perhaps we add an MDN link to the site above?

@Tanvir-rahman
Copy link
Author

@Tanvir-rahman Tanvir-rahman commented Nov 24, 2016

Yes.It is a good idea.....@dhcodes

@dhcodes
Copy link
Contributor

@dhcodes dhcodes commented Nov 24, 2016

If anyone wants to take this up, you'll need to add the word logical to the sentence:

The strict inequality operator (!==) is the opposite of the strict equality operator.

to make it:

The strict inequality operator (!==) is the logical opposite of the strict equality operator.

and modify the MDN Links file to add a reference to the link below and then add the MDN link to the challenge:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Non-identity_strict_inequality_(!)

Note: MDN links are not currently working on staging so mirror the code of other challenges with MDN links as there is no way to currently test locally.

@Manish-Giri
Copy link
Contributor

@Manish-Giri Manish-Giri commented Nov 24, 2016

I'd like to take this up, might need some help with the MDN links though, haven't done it before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants