var array = ['test1','test2'];
var item = 'test2';
if(array.indexOf(item) === -1) {
array.push(item);
}
// array = ["test1", "test2"]
if(array.indexOf(item) !== -1) {
array.push(item);
}
// array = ["test1", "test2", "test2"]
if(this.items.indexOf(item) === -1) {
this.items.push(item);
console.log(this.items);
}
var newItem = "NEW_ITEM_TO_ARRAY";
var array = ["OLD_ITEM_1", "OLD_ITEM_2"];
array.indexOf(newItem) === -1 ? array.push(newItem) : console.log("This item already exists");
console.log(array)
const key = 'mDisplayName'
let updatedData = [...new Map(data.map(item => [item[key], item])).values()];
updatedData.map((item)=>{
console.log(item);
})