Javascript property at index

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Javascript property at index

Post 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.
Post Reply