I wanted to sort an array in a way that one type of element always was first. Other than that, the order was irrelevant. I wrote the following and went on with my day.
["a","b","a","b"].sort((x,y) => x === "b" ? 0 : 1);
Chrome gives me the expected result;
["b","b","a","a"]
But IE and Safari does not.
I understand how to get the result I want, and I guess the problem is in the way the Browser does the comparison between items, but I'm curious of a more in-depth explanation.