6/30 Javascript, I love you:
var b = new Boolean(false);
b; // false
!b; // ALSO false
!b == b; // But this is true!
!!b == !b // Negate both sides and it's false again. FUCK.
if (b) {
// Better fucking believe this will get executed. FUCKING FUCK.
}
// Better fucking believe this will get executed. FUCKING FUCK.
}
\_ what are you trying to do? Use b.valueOf() or b = false;
\_ I don't think it was intended as a practical example.
More of just a big JS WTF. --!OP
\_ I take it you've never been bit by java autoboxing? This
isn't unique to javascript. I'm not sure about c# but I wouldn't
be surprised if it had the same kinds of issues.
\_ c# will do what you would expect. Boxing has performance
(not logic) penalties and only occurs when you try to use
intrinsic types as objects (ex. ((bool) foo).ToString()).
I agree, javascript is whacked. Give the Date object a
spin for more fun. -- saarp |