let people = Array.from(document.getElementsByClassName("person")); let buttons = Array.from(document.getElementsByClassName("button")); buttons.forEach(button => { button.addEventListener("click", function() { buttons.forEach(button => { button.classList.remove("active"); }); button.classList.add("active"); people.forEach(person => { person.classList.remove("hidden"); if (button.dataset.value != 0 && !person.dataset.beh.includes(button.dataset.value)) { person.classList.add("hidden"); } }); }); });