I have found the root of at least part of my problem: the javascript sort() function is not "stable" in Chrome.

My app (described in my original post) scans a text and computes the frequencies of all possible character pairs.

The initial order of the resulting array is alphabetical:

The array is then sorted by the frequency of the pairs. This is where the problem occurs. In Chrome, pairs with identical frequency appear in the sorted array in reverse alphabetical order! Only Chrome does this; see the attached pdf. (The critical cases are marked with asterisks.)Code:for (var i = 0; i < 26; ++i) { for (var ii = 0; ii < 26; ++ii) { countPairs(alphabetStr[i], alphabetStr[ii]); } }

I could fix this problem if I could sort first by the frequency key and then by the alphabetical key, but I don't understand how to do that sort of thing with the javascript sort() function. Can anyone help me here?

Thanks,

JAS