var arr = [{
id:5,
name:'Tony'
},{
id:207,
name:'Ann'
},{
id:33,
name:'Alex'
}];
user = SomeFunction(207);
user.name; // Ann
arr.forEach(function(user){
profiles[user.id] = user;
},this);
profiles[207].name; // Ann
console.log(getElement(207).name);
function getElement (value) {
var x;
arr.some(function (element, index, array) {
if (element.id == value) {
x = element;
return true;
}
return false;
});
return x;
}