Skip to content

Instantly share code, notes, and snippets.

@JoshuaPaulBarnard
Created May 26, 2023 04:07
Show Gist options
  • Save JoshuaPaulBarnard/9521b344bfc1f478f1ce6e327adbd0e7 to your computer and use it in GitHub Desktop.
Save JoshuaPaulBarnard/9521b344bfc1f478f1ce6e327adbd0e7 to your computer and use it in GitHub Desktop.
Question: Can (a==1 && a==2 && a==3) ever evaluate to 'true' in JavaScript?
let b = 1;
Object.defineProperty(globalThis,'a',{
get(){return b++;}
});
let result = Boolean( 'false' )
if (a == 1 && a == 2 && a == 3) {
result = 'true'
console.log( result );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment