AjaxWorld — "JavaScript Puzzlers" by Mike Aizatsky
Posted by sharpstyle on March 21, 2007
Mike works for IntelliJ and showed some of the IntelliJ Idea features that help deal with JavaScript development.
I learned a few things about JavaScript:
- (“0″ == 0) ==> true
- at the same time “switch” will not return true b/c internally it uses “===” for comparison
var a = “0″;
switch (a)
{
case 0: return “AAAA”; break;
default: return “BBBB”;
}
- (“Infinity” == 1/0) ==> true. “Infinity” is evaluated by JS. There is also “-Infinity” and lower case (“infinity” != 1/0)
- using triple equal sign resolves most of the these issues.
~Mike
Dmitry Pavlov said
Thanks for the trick explanation. What a crazy world of javascript?!