JSFiddle - React, Tailwind, and code Playground

HTML

<section>1</section>
<section>2</section>
<section>3</section>

JavaScript

var nodes = document.querySelectorAll('section');
console.log(nodes.length);
document.querySelector('section').remove();
console.log(nodes.length);