I don't understand how Firebug could cause this. Can you reproduce on later versions?
The Web Console, on the other hand, does have this behavior, and it is a consequence of how it evaluates JS: everything is evaluated within *a different global object* than "window". In particular, the Web Console's Array and []-type objects aren't the same as the page's, so e.g. "Array === window.Array" and "isArray([])" would test false there. See also https://bugzilla.mozilla.org/show_bug.cgi?id=690529. Den måndagen den 18:e mars 2013 kl. 23:13:08 UTC+1 skrev bucephalus org: > > Hi there, > > I might have overlooked something trivial, but I can't figure out what it > is and I am really stuck with my programs, due to some strange behaviour. > Consider the following HTML file > > <!DOCTYPE html> > <html> > <head> > <meta http-equiv="content-type" content="text/html" charset="ISO-8859-1"> > <script type="text/javascript"> > function isArray(x) { return (x.constructor && x.constructor === > Array); } > </script> > </head> > <body> > <h1> <code>[2,4,6]</code> is an array? </h1> > <script> > document.write(isArray([2,4,6])); > </script> > </body> > </html> > > When I open this file in Firefox (15.0.1 Firefox for Linux Mint, mint - > 1.0), it shows: > > [2,4,6] ist ein Array? true > > and that is what I would expect. > > But when I open the Firebug (version 1.10.6) console, the input of > isArray([2,4,6]) > returns > false > > This is strange, especially since the input of > [2,4,6].constructor && [2,4,6].constructor === Array > returns > true > > Why does it return different results for isArray([2,4,6]) in Firefox and > Firebug? > > Thank you in advance, > Thomas > -- -- You received this message because you are subscribed to the Google Groups "Firebug" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at https://groups.google.com/forum/#!forum/firebug --- You received this message because you are subscribed to the Google Groups "Firebug" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
