var one = [{id: '1'}, {id: '2'}],
two = [{id: '2'}, {id: '5'}],
twoIds = [];
for ( i in two ) {
if ( two.hasOwnProperty(i) ) {
twoIds[two[i].id] = 1;
}
}
for (i in one) {
if ( one.hasOwnProperty(i) ) {
if ( twoIds[one[i].id] !== undefined ) {
one[i].field = true;
}
}
}