Specification
According to ECMAScript 5 - Section 15.4.4.11 ,
If comparefn is not undefined and is not a sequential comparison function for the elements of this array (see below), the sorting behavior is determined by the implementation ,
[...]
The comparefn function is a sequential comparison function for a set of values โโof S if all the requirements below are satisfied for all values โโof a, b, and c (possibly the same value) in the set S [...]
- The call comparefn (a, b) always returns the same value of v when it is given a specific pair of values โโa and b as two arguments. In addition, Type (v) is Number, and v is not NaN . [...]
That is, if the return value of the comparison function is NaN, then the behavior of the call to sort is determined by "implementation".
On practice
Google Chrome and NodeJS (V8 Engine), as well as Opera (Futhark / Carakan) are returned:
[4, "Red", "$200", "white", false, 0.3, true, 7.4, 12]
Firefox (SpiderMonkey) returns:
[false, 0.3, true, 4, "Red", "$200", "white", 7.4, 12]
Internet Explorer returns:
["Red", "$200", false, 0.3, true, 4, "white", 7.4, 12]