Google Apps script Sort

Viewed 2771

Using App Scripts I've pulled all the headers in an array, strip out the text part and built an array of the below format:
[1,10,23,45,7,12,76,88,9]

Sample code:

var shHeader = sh.getRange(1, 3, 1, 20);
var shH1 = shHeader.getValues();
shH1 = shH1[0].sort();

When I do the normal sort() on the array, the order I'm getting is like:
[1,10,12,23,45,7,76,88,9]

I want sort to give me an output:
[1,7,9,10,12,23,45,76,88]

Can anyone help with any function or some easy hack to get my desired results?

1 Answers
Related