Skip to content

Instantly share code, notes, and snippets.

@vipranarayan14
Created February 22, 2017 17:58
Show Gist options
  • Save vipranarayan14/7758d836cfebc74964e6cd17d34ec4a0 to your computer and use it in GitHub Desktop.
Save vipranarayan14/7758d836cfebc74964e6cd17d34ec4a0 to your computer and use it in GitHub Desktop.
Number.prototype.between = function (a, b, inclusive = true) {
var min = Math.min(a, b),
max = Math.max(a, b);
return inclusive ? this >= min && this <= max : this > min && this < max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment