Delete particular record

Hey, I tried to delete an object using this way
let removeData;
data.map((obj)=>{
removeData = async() => {
const query = new Moralis.Query(‘ContactDetail’)
query.equalTo(‘objectId’,obj.id)
const object = await query.first(({useMasterKey: true}))
if(object) {
object.destroy().then(() => {
alert(“Deleted data!”);
}, (error) => {
console.log(error);
})
}
}
})
I have 3 records in my table, when I tried to delete any one record then last record gets deleted so how I can delete a particular object onClick of the delete button?

try to add logging here, to see what object it returned

you can add logging after every line, to see if the data is what you expect

for example using console.log(JSON.stringify(object)) or logger.info(JSON.stringify(object)) depending on where that code runs

Okay, I will try but not delete particular record