I am unable to remove the duplicate value from array using JavaScript.
var arr = [{
'image': "jv2bcutaxrms4i_img.png",
'gallery_image': true
}, {
'image': "abs.png",
'gallery_image': true
}, {
'image': "acd.png",
'gallery_image': false
}, {
'image': "jv2bcutaxrms4i_img.png",
'gallery_image': true
}, {
'image': "abs.png",
'gallery_image': true
}, {
'image': "acd.png",
'gallery_image': false
}]
var outputList = [];
for (var i = 0; i < arr.length; i++) {
if (outputList.indexOf(arr[i].image) == -1) {
var data = {
image: arr[i].image,
gallery_image: arr[i].gallery_image
};
outputList.push(data);
}
}
console.log(outputList)
Here I can not delete the data properly.