Skip to content

Instantly share code, notes, and snippets.

@brunomonteiro3
Created November 10, 2016 09:09
Show Gist options
  • Save brunomonteiro3/ecfa4eb1eaa848b1cc7495860308aa91 to your computer and use it in GitHub Desktop.
Save brunomonteiro3/ecfa4eb1eaa848b1cc7495860308aa91 to your computer and use it in GitHub Desktop.
Check if value is between X or Y
function between(x, min, max) {
return x >= min && x <= max;
}
@brunomonteiro3
Copy link
Author

Usage example:

if (between(myVar, 1, 30)) {
	alert('Is between 1 and 30');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment