Concat two nodelists

Why don’t you use one selector to select them at the same time than you do not need to concat them and you end up with an HTML Collection instead of an Array.

var elems = document.querySelectorAll("ul > li, .mobile > *");
console.log(elems);
<ul><li>x</li></ul>
<div class="mobile">y</div>

Leave a Comment