Christopher said:
IE6, and no, I tried distilling it down and the problem went away. I
didn't post with much hope of solving the problem, unfortunately.
There didn't seem to be a problem with your code...
I tried your exact code in IE6 -- no problems whatsoever. (In my case,
IE started with "fresh" code.)
I have, every so often, noticed that IE6 has a tendency to "get stuck"
when editing/changing JScript code. It happened with my post concerning
"Array_unique". When testing repeatedly, it would pass the last line of
the prototyped function's statement without error (without testing if
there was an array length, i.e., if there existed more than one indexed
array item). The next day, when I started IE "fresh" and tried the page
again (because I was pretty sure that line should not have worked for
"associative" only arrays) -- sure enough, it started kicking the
errors. Also, I always use control-refresh, which is supposed to force a
reloading of the page from the "server" (and view source WILL show the
changed code), and still IE will run something incorrectly. I also
notice this situation happens more frequently when in: Tools > Internet
Options > Temporary Internet Files > Settings is set to anything other
than "Every visit to the page". Setting this option definitly helps when
developing JScript -- but is often inconvenient when surfing.
If you run into seemingly absurd situations like this [your original
post code was exceedingly simple and clear -- "obvious"] and your code
should, without question, absolutely work, try closing all instances of
IE and restarting fresh, or changing the above mentioned option while
you develop your code [still use control-refresh as you work!].
Now, I'm probably going to get slammed for these comments. I have no
absolute proof and cannot make the situation recreatable in any specific
circumstances. Maybe others have noticed, or almost noticed, the same
situation, I don't know. The array_unique code as being "read into" IE
and the first version I posted was working without error when I posted
it (I was double checking with View Source to make sure it was the
"right" code) . The errors did not start occuring until the browser was
restarted. I currently have my temporary internet files setting options
set to Automatcally.
[Take with a grain of salt, 2 aspirin, and don't call me in the morning]