Biotoxsin,
<div>
<div class="elem"></div>
<div class="elem"></div>
<div class="elem et"></div>
<div class="elem"></div>
</div>
<script>
const index = [...document.querySelectorAll(".elem")].indexOf(document.querySelector(".et"));
alert(index);
</script>
<div>
<div class="elem"></div>
<div class="elem"></div>
<div class="elem et"></div>
<div class="elem"></div>
</div>
<script>
const index = [...document.querySelectorAll(".elem")].findIndex(div => div.classList.contains("et"));
alert(index);
</script>
<div>
<div class="elem"></div>
<div class="elem"></div>
<div class="elem et"></div>
<div class="elem"></div>
</div>
<script>
let index, div;
for ([index, div] of [...document.querySelectorAll(".elem")].entries()) if (div.classList.contains("et")) break;else index = -1;
alert(index);
</script>
<div>
<div class="elem"></div>
<div class="elem"></div>
<div class="elem et"></div>
<div class="elem"></div>
</div>
<script>
let div = document.querySelector(".elem.et"), index = div ? 0 : -1;
if(div) while(div = div.previousElementSibling) {
div.classList.contains("elem") && index++
}
alert(index);
</script>