A range function for javascript.