469,951 Members | 2,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

netscape & associative arrays

g
Hi,

I would like to step through all the key-value pairs in an associative
array. I'm trying:
for (var i=0 in hashOfItems) { // go through all keys in the hash
hashOfItems
// do sth
}
which works fine in Internet Explorer but does not seem to be
recognised in Netscape Navigator. What is the right way to write this?

Thanks,
Gina
Jul 20 '05 #1
1 1061


g wrote:
I would like to step through all the key-value pairs in an associative
array. I'm trying:
for (var i=0 in hashOfItems) { // go through all keys in the hash
hashOfItems
// do sth
}


Why do you want to set i = 0?? Simply do

for (var key in object) {

}
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

27 posts views Thread by Abdullah Kauchali | last post: by
6 posts views Thread by mark4asp | last post: by
4 posts views Thread by Robert | last post: by
8 posts views Thread by Derek Basch | last post: by
7 posts views Thread by Robert Mark Bram | last post: by
41 posts views Thread by Rene Nyffenegger | last post: by
11 posts views Thread by Bosconian | last post: by
2 posts views Thread by Venkatesh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.