[].forEach.call(document.querySelectorAll('.nav__dropdown-link'), function(el){ if(el.nextElementSibling && el.nextElementSibling.matches('.nav__dropdown_second')) el.classList.add('nav__dropdown-link_dropdown'); });