Skip to content

Instantly share code, notes, and snippets.

@mildfuzz
Created April 15, 2016 10:08
Show Gist options
  • Select an option

  • Save mildfuzz/5d38097869b98e62f0ffbe79c12b5321 to your computer and use it in GitHub Desktop.

Select an option

Save mildfuzz/5d38097869b98e62f0ffbe79c12b5321 to your computer and use it in GitHub Desktop.
limiter
function limit(num, bottom, top) {
if (top < bottom) {bottom = top;}
if (num < bottom) {
return bottom;
}
if (num > top) {
return top;
}
return num;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment