Does anyone have an explanation of how javascript could do this. Somehow this function is both true and false at the exact same time. This is just one pass, no looping or anything.
console.log(key);
if (this.watches.get(key)) {
console.log("found it");
} else {
console.log("whhhat?");
}
console.log(this.watches);
Firebug Console logs as is.
search-key
found it
Object search-key=Object $family=Object
whhhat?
Object search-key=Object $family=Object
[EDIT] Here it is. The full script and the block of output above is copy and paste from firebug. This is the strangest thing I have ever seen. http://snipt.org/Hkl
I use mootools framework so the this.watches = $H({}); is a hashtable. I was using an Array and was experiencing the exact same issue, then switched it to $H({}) because I thought i was doing something wrong.