Page 1 of 1

Javascript property at index

Posted: Tue Oct 07, 2008 6:51 pm
by JellyFish
How do I get the property of an object at a specific index? For example:

Code: Select all

 
object[i]
 
this doesn't work for objects unless the object is a array. But I'm looking for a way to do this for objects.

Now I know if i is a string of the property name that it'll return that property, but i is a integer in this case. I don't want to loop through all the properties or anything like that, I'd just like to jump to a specific index in the object.

I hope this makes sense. Is there any way to do this in JavaScript?

Thanks for reading, all help is appreciated.