Executing isArray([2,4,6]) via Firebug's Command Line using Firefox 19.0.2
+ Firebug 1.11.2 on WinXP correctly returns true. So I suggest you update
your browser and Firebug to the current versions and try it again.
Also note that you can use
Array.isArray()<https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray>instead
to check whether a variable is an array, which is supported by all
current browsers.
Sebastian
On Monday, March 18, 2013 5:13:08 PM UTC-5, bucephalus org wrote:
>
> 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.