What am I trying to achieve?
So I have an array which needs to be checked for duplicates and if a duplicate is found I want to display the duplicate found using console.log for now. I must add this this code is based within a function.
The user will then add to this array using some input within the frontend , which is I currently have completed but it is not needed to solve this problem.
Here is my Array below which i want to find if there are duplicates within it.
const repeatedNumEvent = {
PlayerNumber: this.state.PlayerNumber,
eventType: this.state.eventType
};
basically if an new array object has identical values then display the duplicate
I assume I will have to use a for loop using the .length function but i am unsure how to achieve my task.
Possible array data below
{PlayerNumber: "12", eventType: "Goal"}
If you have any question just ask below. Thanks.