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

Unnecessary comparison #128

Open
eliasmalik opened this issue May 12, 2017 · 0 comments
Open

Unnecessary comparison #128

eliasmalik opened this issue May 12, 2017 · 0 comments

Comments

@eliasmalik
Copy link

https://github.com/FAC10/MPBots/blob/97ce6bb4717b65f056da27db3a3eda41c1a4a362/src/helper_functions/answer_objects.js#L11

This comparison can never be true because you are looking for a strict (i.e. object reference) equality with an object you are creating within the predicate.

Any time you create an object literal, you create a new object reference.

Strict equality between objects compares the references. That is, obj1 === obj2 can only ever be true if both those variables refer to the same memory location. But when you create an object literal, that is a brand new object, in a different memory location.

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

No branches or pull requests

1 participant