-1

We have a name value field , and its not accepting duplicate names .However in integration , its creating record using the duplicate names .How do we validate this to ignore duplicate names in the request

Divya G
  • 15
  • 3

1 Answers1

0

Use array filter to the removed duplicate values

const array =  ["test", "test1", "test2", "test", "test", "test1", "test", "test2", "test"];


var uniqueArray = array.filter(function(elem, index, self) {
    return index === self.indexOf(elem);
})

console.log(uniqueArray);
Mohammad Ali Rony
  • 4,695
  • 3
  • 19
  • 33