Assuming this JSON object:
var obj = {
\"set1\": [1, 2, 3],
\"set2\": [4, 5, 6, 7, 8],
\"set3\": [9, 10, 11, 12]
};
The \"set
My solution:
Object.prototype.__index=function(index)
{var i=-1;
for (var key in this)
{if (this.hasOwnProperty(key) && typeof(this[key])!=='function')
{++i;
}
if (i>=index)
{return this[key];
}
}
return null;
}
aObj={'jack':3, 'peter':4, '5':'col', 'kk':function(){alert('hell');}, 'till':'ding'};
alert(aObj.__index(4));