13Foch,
document.addEventListener( "DOMContentLoaded" , function() {
const menuToggle = function (selector) {
const menu = document.querySelector(selector);
if(!menu) return;
menu.addEventListener("click", function (event) {
let target = event.target;
if (target = target.closest(".menu__name")) {
event.preventDefault();
let parent = target.parentNode;
let children = parent.parentNode.children;
[...children].forEach(el => el.classList[el === parent ? "toggle" : "remove"]("menu__item--active"))
}
});
}
menuToggle('.menu');
});