Hm thanks for confirming that. What's weird is that this is gone if I do this.toString(), then it correctly recognizes the variable. Anyway I still love the firebug (<- no pun intended), it's an awesome little tool ; ).

-- Felix Geisendörfer aka the_undefined
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de


Jörn Zaefferer wrote:
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 ; ).
To my experience this strange behaviour is a firebug (<- pun intended). Ahem, a firebug bug. Firebug thinks your String is an array (it has a length property) and therefore prints it as an array, though it does that only in special cases.

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to