Question: ```js
var table = 
    [
        {"name":"Joe", "Level":1}, 
        {"name":"Bob", "Level":1B}, 
        {"name":"Carl", "Level": 7},
        {"name":"Mike", "Level": 1A},
        {"name":"Sal", "Level": 2}
    ]
var tableHeaders = scope.SortTableColumnHeaders(table)

scope.SortTableColumnHeaders = function (array) {
        var unique = {};
        var distinct = [];
        for (var i in array) {
            if (typeof (unique[array[i].Level]) == "undefined") {
                distinct.push(array[i].Level);
            }
            unique[array[i].Level] = 0;
        }
        return distinct.sort();
    };
```

I have an object that looks like the above code where I pull out a distinct array like
[1,10,1A,1B,2,7]
where I can have int (1-10) and strings (1A, 1B, 1C)

I want to sort the int's in order first and then the strings second so it will always look like 
[1...10,1A,1B,1C]

I tried distinct.sort(), but that doesn't work.

Answer: 
Well, ASCII values are continuous, and numbers are lower than chars from the alphabet, so if you can live with the sum of the ASCII values (that would work with `1A`, `1B` and so on)

```
var table = [
   {"name":"Joe", "Level": '1'}, 
   {"name":"Bob", "Level": '1B'}, 
   {"name":"Carl", "Level": '7'},
   ...
]

function sortByCharCode(a,b) {
    function charCodeInt(s) {
        result = 0;
        for (var i=0;i<s.length;i++) {
            result += s.charCodeAt(i);
        }
        return result;
    } 
    a = charCodeInt(a.Level);
    b = charCodeInt(b.Level);
    if (a < b) return -1;
    if (a > b) return 1;
    return 0;
}

$scope.sortTable = function() {
   $scope.table.sort(sortByCharCode);
}

```
One way to do it would be to enumerate your sort explicitly:

```js
var definedSort = [1,2,3,4,5,6,7,8,9,10,'1A','1B','1C'];
var someArray = ['1A', 4, 8, 5, 1, 9, '1C', '1B'];

someArray.sort(function(a,b) {
    return definedSort.indexOf(a) - definedSort.indexOf(b);
});

alert(someArray);
```

However, given your simple restrictions, you can also implement it in more convoluted ways:

```js
var someArray = ['1A', 4, 8, 5, 1, 9, '1C', '1B'];

someArray.sort(function(a,b) {
  return (a - b) || -a || +b || (a > b)
});

alert(someArray);
```