<div class="cont">
<div class="box"></div>
<div class="box"></div>
</div>if (!el.nextElementSibling.classList.contains('box'))Uncaught TypeError: Cannot read property 'classList' of nullно понять почему закривающый тег = null не могу
The NonDocumentTypeChildNode.nextElementSibling read-only property returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.Источник: MDN nextElementSibling
.box нет "следующего соседа".</div> - вообще-то не самостоятельный элемент, а часть родительского .contel.parentNode или el.closest('.cont')