3

I have a variable data a array of objects. Now I want to check if there a duplicates values except 0. What I’ve done so far is the code snippet below:

The alert shows me true it should be false cause 0 is not included for checking. Please help. Thanks

var data = [{id: 0},  {id: 1}, {id: 3}, {id: 0},];
            
            
var checkdata= data.map(function(item){ 
return item.id });
var isDuplicatedata= checkdata.some(function(item, idx){ 
    return checkdata.indexOf(item) != idx 
});
            
alert(isDuplicatedata)