From: Dr J R Stockton on
In comp.lang.javascript message <tytbxo8f.fsf(a)gmail.com>, Sun, 21 Feb
2010 04:27:12, Lasse Reichstein Nielsen <lrn.unread(a)gmail.com> posted:
>laredotornado <laredotornado(a)zipmail.com> writes:
>
>> Given an associative array, how do I get an array of the keys of that
>> associative array?
>
>If arr is your associative array (i.e., an object)
>In ECMAScript 5:
> var keys = Object.keys(object)
>In ECMAScript 3:
> var keys = [];
> for (var key in arr) { keys.push(key); }

The second entry should I suppose be headed "In ECMAScript 3 & 5"; and
will then be the way to code it (for the open Web) until all browsers in
use are sufficiently ES 5 compliant.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7)
Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)