If I have an array like this:
var arr = ['one','two','three'];
I can access the various parts by following these steps:
console.log(arr[1]);
How can I access the properties of an object in their order, and not by key?
Example:
var obj = { 'something' : 'awesome', 'evenmore' : 'crazy' }, jbo = { 'evenmore' : 'crazy', 'something' : 'awesome' };
How do I get the first property for each object - "something" from obj and "evenmore" from jbo - without using the property name explicitly?
Now, some of you seem to think I'm behind something like:
console.log(obj['something']);
This is not the case, I am specifically targeting the index, as in the first example - if possible.
javascript arrays
daryl Oct 23 '11 at 13:00 2011-10-23 13:00
source share