Attribut de données JavaScript les plus proches

const schoolInfo = [
  { id: '1' }
];

const school = document.querySelector('button');
const popUpInfo = schoolInfo.find(
  (x) => x.id == school.closest('[data-idschool]').dataset.idschool
);
console.log(popUpInfo);
EnzoK