I need to know if an array of objects contains at least two same objects in it, in JavaScript.
I have a form that allow people to create questions (title, description, type, answer options). I need to check whether the user has entered multiple answer options with the same label. They are stored in an array.
// The array of answer options
let array = [{value: 'a'}, {value: 'b'}, {value: 'c'}, {value: 'a'}]
I tried using array.indexOf({value: 'a'})
and array.lastIndexOf({value: 'a'})
but they both give me an index of -1.