Javascript Hashes Don't Really Take Objects as Keys
Wed Jul 12, 14:02
Try it out for yourself.
<script type="text/javascript">
//The setup
var hash = {}
hash[window] = 'a firefox window'
//The test
for (var i in hash) {
alert( i == window ) // false
alert( typeof(i) ) // string
alert( hash['[object Window]'] ) // 'a firefox window'
}
</script>
Apparently, toString() is called on objects that get used as keys.