If you have stored those values as string then you can use below script :
var x= "1,22,8,3,4,5,6"; //(This is list of numbers which i found from gliderecord and output is same as in variable x)
var array = x.split(",");
var min = Math.min.apply(null,array);
gs.print(min);
var max=Math.max.apply(null, array)
gs.print(max);
If you have stored those values as array of numbers then you can use below script :
var array = [1,22,8,3,4,5,6]; //(This is list of numbers which i found from gliderecord and output is same as in variable x)
var min = Math.min.apply(null,array);
gs.print(min);
var max=Math.max.apply(null, array)
gs.print(max);
Let me know i