I have this extremely simplified code that produces opposite results in Firefox to what you get (and expect) in Chrome or Edge (haven't tried other browsers):
[1, 2, 3, 4, 5].sort((a, b) => 1).forEach(a => document.write(a));
It reverses the array in Firefox for some reason. Is this a bug or am I missing something?