What is the best way to see if a row of data is within a JavaScript object.
I made a simple example down below.
data within appointment
is the same as the first row of upcoming_appointments
upcoming_appointments = [{"DOB":"01-27-2002","name":"Judy, W." ,"PCD":"Dr-S"},
{"DOB":"08-15-1995","name":"John, V." ,"PCD":"Dr-C"},
{"DOB":"07-05-1992","name":"David, C.","PCD":"Dr-S"},
{"DOB":"01-15-2002","name":"Anna, S." ,"PCD":"Dr-J"},
{"DOB":"01-15-2002","name":"Jeff, D." ,"PCD":"Dr-P"}];
appointment = [{"DOB":"01-27-2002","name":"Judy, W." ,"PCD":"Dr-S"}];
if(upcoming_appointments.includes(appointment[0])){
console.log('true');
}
else{
console.log('false');
}
desired output
true
current output
false