target.closest('a')
const tabstov = document.querySelectorAll(".tabstovnl");
const blocks = document.querySelectorAll(".tabstovb");
const tabClickHandler = ({ target }) => {
const targetTab = target.closest('a');
const block = document.querySelector(`${targetTab.getAttribute('href')}`);
const isTargetNotActive = !targetTab.classList.contains('tabstovnl--active');
if (isTargetNotActive) {
tabstov.forEach(tab => tab.classList.remove("tabstovnl--active"));
blocks.forEach(block => block.classList.remove("tabstovb--active"));
}
targetTab.classList.toggle("tabstovnl--active", isTargetNotActive);
block.classList.toggle("tabstovb--active", isTargetNotActive);
}
tabstov.forEach(tab => tab.addEventListener("click", tabClickHandler));