August 1st, 2010
I was just bitten by this:
var foo = "2";
var bar = 2;
switch (parseInt(foo)) {
case bar:
alert("match");
break;
default:
alert("no match");
}
That code should alert “match” – but take out the parseInt, and you get “no match.”
It looks like the switch statement uses type checking (i.e. ===, not ==) in FireFox 3.6.8 for Mac (haven’t tried other browsers).
Posted in: Technology | Comments (0)
April 21st, 2010
Love it.
Posted in: Technology | Comments (0)
April 19th, 2010
Posted in: Technology | Comments (0)
« Older Posts