-2

I am having this line of javascript on a live web shop: tmp_offices.sort((a, b) => (a[IX_OFFICE_NAME] > b[IX_OFFICE_NAME]) ? 1 : ((b[IX_OFFICE_NAME] > a[IX_OFFICE_NAME]) ? -1 : 0));

It worked fine for a month with whatever browsers. Until today when a client browsed it with Internet Explorer 11. It generates error "Syntax error". The same line of code works fine with Edge browser.

I am aware IE11 is legacy and not supported but apparently it is still in use. What is the problem and how do I solve it?

Ivan Milanov
  • 69
  • 1
  • 6

1 Answers1

0

Can you try this one?

    tmp_offices.sort(function (a, b) {
      return a[IX_OFFICE_NAME] > b[IX_OFFICE_NAME] ? 1 : b[IX_OFFICE_NAME] > a[IX_OFFICE_NAME] ? -1 : 0

;
});
woxel
  • 157
  • 8