caetus,
var o = {
email: 'js@.ru',
username: {
first: 'Bob',
last: 'Fox'
},
dob: '12.02.2002'
}
var f = function (item) {
var a = o[item.shift()]
while (item.length && a) {
a = a[item.shift()]
}
return a;
}
alert(f(['username','first']));
alert(f(['email']));