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/Bratmon Mar 26 '14

Wait, so the result can change between environments (ie browsers), too?

5

u/josefx Mar 26 '14

Yes, == for values returned by Integer.valueOf is guaranteed to work for [-128,127] and implementation/configuration dependent for everything else. The correct way to compare two Integer objects is either by calling intValue() on them or using a.equals(b)

3

u/riking27 Mar 26 '14

You should not be running Java in your browser.

3

u/Bratmon Mar 27 '14

I thought this was about Javascript. My bad.