Hi folks,
I'm very confused. I'm trying to iterate through the elements of an
array by using the jQuery.each() function. Take a look at the code below:
$.each(['vendors', 'models', 'views'], function()
{
console.log(this, typeof(this));
});
I would expect firebug to produce an output like this:
"vendors" "string"
"models" "string"
"views" string"
Instead I get this:
["v","e","n","d","o","r","s"] "object"
["m","o","d","e","l","s"] "object"
["v","i","e","w","s"] "object"
Which is why I am confused. Those objects look like arrays in the
console, but when trying this.join('') to convert them into a string
again I get the error that this function is not defined, indication that
those this objects are in fact no arrays but something else. However
using alert(this) will make them look as if they were strings.
Have I gone crazy? Is there a bug in firebug? Or am I just incredibly
stupid?
I'd appreciate any form of help, regardless of eventual truths about the
state my sanity ; ).
-- Felix Geisendörfer aka the_undefined
--
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/