JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test"></div>

JavaScript

function gi(id){return document.getElementById(id)}

    a= [1,5,1,2,3,5,3,4,3,4,3,1,3,6,7,752,23]


for(i=0; i < a.length; i++){
    if(a.length - 1 === i) {
        console.log('loop ends');
    }
    
    gi('test').innerHTML+=''+a[i]+' <br>';
}