Skip to content

Instantly share code, notes, and snippets.

@tts7en
Last active June 16, 2023 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tts7en/5e3777985d68685bafcc78467ffba95d to your computer and use it in GitHub Desktop.
Save tts7en/5e3777985d68685bafcc78467ffba95d to your computer and use it in GitHub Desktop.
const ZERO = 0;
const ONE = 1;
const TWO = 2;
/**
* Checks if a's state satisfies a certain requirement so that the
* caller function can understand what's happening with a and
* process accordingly.
*/
function checkA(a) {
const isInt = int(a) == a;
const checkDiv = (a >> ONE) == ONE;
const checkMod = (a % TWO) == ZERO;
If (isInt && checkDiv && checkMod) {
return a == a;
} else {
return a != a;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment