Skip to content

Instantly share code, notes, and snippets.

@jveldboom
Created April 7, 2011 12:38
Show Gist options
  • Save jveldboom/907680 to your computer and use it in GitHub Desktop.
Save jveldboom/907680 to your computer and use it in GitHub Desktop.
find the a range in between two numbers
function getMiddleRange(min,max,limit,type)
{
--limit;
var new_num
var data = '';
for(var x=0; x<=limit; x++)
{
var new_num = Math.ceil((max - min) / limit);
new_num = min + (new_num * x);
if(x==0){new_num = min;}
if(x==limit){new_num = max;}
if(type == 'date'){new_num = formatDate(new_num);}
data += '|'+new_num;
}
return data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment