I have got an array like this:
[1, Stopped]
[2, Waiting]
[3, Finished]
[4, Stopped]
[5, Running]
The number is the id of the program and the text is the status of the program. I need to sort this array according to the next order:
['Error','Halted','Blocked','Finished','Waiting to Start','Waiting','Stopping','Running','Idle','Stopped','Opened','Ready'];
I use this for every other browser except IE8:
var a = [[1, 'Stopped'],
[2, 'Waiting'],
[3, 'Finished'],
[4, 'Stopped'],
[5, 'Running']];
var order = ['Error','Halted','Blocked','Finished','Waiting to Start','Waiting','Stopping','Running','Idle','Stopped','Opened','Ready'];
a.sort(function (a, b) {
return order.indexOf(a[1]) - order.indexOf(b[1]);
});
It is working in all different browsers except for IE8. Can anyone tell me how to sort it in IE8?