Tuesday, September 18, 2007

0=="" is true

Debugging something on Sahi, came across this interesting equality in javascript:

0 == "" is true!

So are:

1 == "1" etc.

An easy way to test these out (and any other single line javascript) is to type

javascript:0==""

on the browser url navigation bar.
Yes, it works on IE and firefox.