Another solution using Array.prototype.reduce
and a hash table - see demo below:
var newarray=[ { Email:"test1@gmail.com", ID:"A" }, { Email:"test2@gmail.com", ID:"B" }, { Email:"test3@gmail.com", ID:"A" }, { Email:"test4@gmail.com", ID:"C" }, { Email:"test5@gmail.com", ID:"C" } ];
var result = newarray.reduce(function(hash){
return function(prev,curr){
!hash[curr.ID] && (hash[curr.ID]=prev.push(curr));
return prev;
};
}(Object.create(null)),[]);
console.log(result);
.as-console-wrapper{top:0;max-height:100%!important;}