Skip to content

Instantly share code, notes, and snippets.

@paul-bjorkstrand
Created May 6, 2014 13:36
Show Gist options
  • Save paul-bjorkstrand/0e3008a7d7d772d4f16b to your computer and use it in GitHub Desktop.
Save paul-bjorkstrand/0e3008a7d7d772d4f16b to your computer and use it in GitHub Desktop.
Simple min-max, bounding a value between a minimum and maximum
if (!Math.minMax) {
Math.minMax = function(min, max, val) {
return Math.max(min, Math.min(max, val));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment