I have this json object which has seq 1,2,3,4. And in the main HTML page, user can edit the seq number and I need to make sure that every seq is unique and must not repeat like 2 set of "1" & "1". Unfortunately, it is buggy and sometimes it works sometimes not. Can someone point out my mistake? I want to ignore blank value as well
$scope.myDataset.map(v => v.seq).sort().sort((a, b) => {
if (a !== '' && b !== '' && a === b) {
$scope.duplicateFound = true
}
})
$scope.myDataset = [
{ seq: '1', },
{ seq: '2', },
{ seq: '3', },
{ seq: '4', },
{ seq: '', },
{ seq: '', },
];