code: function compareNumericWithNaNs(x, y) {
      if (!isNaN(x) && !isNaN(y))
        return x - y;
      if (isNaN(x))
        return 1;
      if (isNaN(y))
        return -1;
      return 0;
    }
docs: Compares two numeric values when one or both might be undefined or NaNs.
  Undefined / NaN values are sorted after others.