JSFiddle - React, Tailwind, and code Playground

HTML

<p id='a1'>
<p id='a2'>
<p id='a3'>
<p id='a4'>
<p id='a5'>
<p id='a6'>
<p id='a7'>
<p id='a8'>
<p id='a9'>
<p id='a10'>

CSS

p:before {
    content: '<p> ';
}

JavaScript

onload = function() {
    var aarr = [], i = 10;
    while(i)
        aarr.unshift(document.getElementById('a' + i--));
    // at this point aarr is [object Array]
    // put all of your code here
    i = aarr.length;
    while(i--)
        aarr[ i ].textContent = aarr[ i ].id;
};
// at this point aarr is undefined