if I have a js array like below, is there a simple way to re-group the array values by range, the logic is based on the range step, the range step is 1, so if the array values are continuous increased by 1, then it should be write like "1-3", otherwise it should be break to another group, thanks a lot!
var list = ["1", "2", "3", "5", "6", "9", "12", "13", "14", "15", "16"]
function(list) {
// * some function here //
return ["1-3", "5-6", "9", "12-16"]
}