News for hackers. Stuff that matters.
Re:Fun with JavaScript Arrays by Wilya on Wednesday June 12, 2013 @05:20AM (#5867234)
sort() is a bit weird, I have to agree, but the '==' thing is a common problem to a lot of languages, not exactly a js-specific WTF.

Off the top of my mind:

In Python, '==' on arrays compares elements.

In Java, '==' on arrays compares the objects themselves. You have to use equals() to compare the elements.

In C(++) arrays, '==' compares the objects. But for std::vector, it compares the elements.

One could argue it's a language choice more than a screwup.

Re:Fun with JavaScript Arrays by arethuza on Wednesday June 12, 2013 @05:56AM (#5867323)
Common Lisp has quite a few equality functions: eq, eql, equal, equalp

http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html

Re:Fun with JavaScript Arrays by hcarvalhoalves on Wednesday June 12, 2013 @05:11PM (#5870770)
The point is not what "==" should do. The point is you have even two equality operators - with subtle differences - and still no way to compare two arrays by value without boilerplate, which should be trivial.