RESOLVED WONTFIX 187134
Inconsistent output compared with other JS engines when using sort()
https://bugs.webkit.org/show_bug.cgi?id=187134
Summary Inconsistent output compared with other JS engines when using sort()
sunlili
Reported 2018-06-27 21:26:50 PDT
Hello, The following code behaves strangely (inconsistent with other engines). a=[3.3,2.2,1]; a.sort(function () { return -1;}); In Safari, output is [1, 2.2, 3.3] However, output should be: [3.3, 2.2, 1] BT group 2018.6.28
Attachments
Yusuke Suzuki
Comment 1 2018-06-28 07:30:03 PDT
I think this is OK. This relies on how comparator is called (since it does not produce consistent results, comp(a, b) => -1 comp(b, a) => -1), and it is implementation dependent according to the spec.
Note You need to log in before you can comment on or make changes to this bug.