Created
May 4, 2025 23:29
-
-
Save HenriqueSilverio/0966280631a3fc0bfea3d37ddaecbf33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class False { | |
not() { | |
return new True() | |
} | |
or(aBoolean) { | |
return aBoolean | |
} | |
toString() { | |
return 'false' | |
} | |
} | |
class True { | |
not() { | |
return new False() | |
} | |
or(aBoolean) { | |
return this | |
} | |
toString() { | |
return 'true' | |
} | |
} | |
const falsy = new False() | |
const truthy = new True() | |
console.log(`falsy.not(): ${falsy.not()}`) | |
console.log(`falsy.or(truthy): ${falsy.or(truthy)}`) | |
console.log(`falsy.or(falsy): ${falsy.or(falsy)}`) | |
console.log(`truthy.not(): ${truthy.not()}`) | |
console.log(`truthy.or(falsy): ${truthy.or(falsy)}`) | |
console.log(`truthy.or(truthy): ${truthy.or(truthy)}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment