// Get the index of an obj by using its id as param
function teste(id) {
// use findeIndex() to get the id of an array of objects that would match the param
const index = data.findIndex((item) => item.id === id);
// then, you can use this as base for statements
id === data[index].id ? doSomething() : doOtherThing();
}