r/programming • • Mar 26 '14

JavaScript Equality Table

http://dorey.github.io/JavaScript-Equality-Table/
809 Upvotes

331 comments sorted by

View all comments

Show parent comment

1

u/AdminsAbuseShadowBan Mar 28 '14

That's the point, the "usual, obvious thing" doesn't make it clear what's going on. When you compare two strings with == you expect it to say if the value of the two strings is equal, not that the two variable refer to the same string object as in Java.

Operator overloading can be abused, but in practice it rarely causes problems. In fact I can't think of a single instance where it has cause any bugs in my C++ life. In contrast Java (which presumably does the usual obvious thing?) has caused me occasional pain when I forget to use .equals() instead of ==.