Access non-numeric Object properties by index?

“I’m specifically looking to target the index, just like the first example – if it’s possible.”

No, it isn’t possible.

The closest you can get is to get an Array of the object’s keys, and use that:

var keys = Object.keys( obj );

…but there’s no guarantee that the keys will be returned in the order you defined. So it could end up looking like:

keys[ 0 ];  // 'evenmore'
keys[ 1 ];  // 'something'

Leave a Comment