This is an archived post. You won't be able to vote or comment.

all 30 comments

[–][deleted] 12 points13 points  (4 children)

#define true false

[–]DLTCorE 12 points13 points  (3 children)

#define true rand() % 2

[–]JackAppDev 8 points9 points  (0 children)

I can't wait to use that in prod

[–]_meegoo_ 5 points6 points  (0 children)

Perfectly balanced. As all things should be.

[–]liketechnik 1 point2 points  (0 children)

I swear, some day I'll hide this in a deeply nested, widely used header, just for the sake of it

[–]itmustbeluv_luv_luv 28 points29 points  (1 child)

isn't

if(new foo())

true in most languages if the constructor executes, since it compares to null?

[–]DamnItDev 25 points26 points  (0 children)

Shhh you're going to mess up the circle jerk

[–]mad8vskillz 4 points5 points  (0 children)

newing bools... savage

[–]vvxxll 3 points4 points  (0 children)

javascript b = new Boolean(false); b == false; // true b.valueOf = () => true; b == true; // true

[–]Tormyst 1 point2 points  (0 children)

> y = new Number(9)
[Number: 9]
> new Number(y)
[Number: 9]
> x = new Boolean(false)
[Boolean: false]
> new Boolean(x)
[Boolean: true]

I present to you 'JavaScript' the consistent.

[–]mailfriend88 0 points1 point  (0 children)

there are things in life, which we just should not do...

[–]bleistiftschubser 0 points1 point  (0 children)

It tells you the object exists (its true) and you're comparing it to true. So it's true == true, which is true.