There is an array like the one below in merhava vue js, and when I send deletefuction(2) of it, I want to learn the index order of the data that is actually id 2, but I can't find it, where am I doing the search wrong?
{
id:1,
name:'hello',
},
{
id:2,
name:'about',
},
{
id:3,
name:'contact',
}
const state = reactive({
postList: [],
});
function deleteFuncton(idx) {
const found = state.postList.find(element => element.id === idx)
console.log(found)
}