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.
Tuesday, September 18, 2007
Subscribe to:
Post Comments (Atom)
3 comments:
An untyped / interpreted language issue?
"enna kodumai saravana ithu" :D
No, a not knowing javascript issue. The equality operator in javascript is ===, not ==. See douglas crockford's (yahoo javascript guru) website: http://www.jslint.com/lint.html down the page there is a header == and !=.
Also see http://www.jslint.com
Post a Comment