I want to check if there is an item inside of the array with the same 'datum'. If that is the case I want the program to do nothing, but if that's not the case I want it to add it to my array.
I already have the following code. this just gets the data from input fields in the html, and places the data inside the array.
I only need to check if there's already an item inside with the same 'datum', but I have no idea how to get this done.
store(newValue:number, newDatum, newAanwezig, newComment){
let billable = new BillableHours();
billable.datum = newDatum;
billable.hours = +newValue;
billable.aanwezig = newAanwezig;
billable.comment = newComment;
if(billable.aanwezig == "Aanwezig" && billable.hours !== null && billable.datum !== null) {
this.urenRegistratie.push(billable);
}
}