var obj1 = {id: 'id1', data: 'some data'};
var obj2 = {id: 'id2', data: 'another data'};
var objectsArr = [obj1, obj2];
var objects = {obj1.id: obj1, obj2.id: obj2};
var fromArr, fromObj;
for (var i=0; i<objectsArr.length; i++) {
if (objectsArr[i].id === 'id1') {
fromArr = objectsArr[i];
break();
}
}
fromObj = objects['id1'];