I have a very simple sorting function that sorts objects by index
:
panoramas.sort((a, b) => {
if (a.index > b.index) return 1
})
Input:
[
{ index: 0 },
{ index: 2 },
{ index: 1 }
]
Output:
[
{ index: 1 },
{ index: 2 },
{ index: 3 }
]
The function works in Chrome and Firefox, but not in IE (the array isn't being sorted at all.)
Is there something wrong with my function?