In an object such as:
var a = {"a":"value1", "b": "value2", "c":"value3"};
How do I get the value of the second element in the object without knowing the element's name? Same for variable n3 and so on...
According to the language spec (see sections 4.3.3 and 12.6.4), the properties of an object are not ordered, so there is no "second element". This is different from the numeric properties (subscripts) of an array.
The best approach, if you want to associate a particular order to the keys, is to store the keys themselves in an array and access them by subscript (not using for...in).
All major browser implementations will iterate the properties in the order in which they were added. While this is ill-advised, you might be able to get away with:
a[Object.keys(a)[1]]
to get the "second element" value. Just be aware that this relies on an accident of implementation and is not guaranteed to work everywhere. Basically, it's an accident waiting to happen if you do this.
for..in will return them out of order in some browsers in some cases.