JSFiddle - React, Tailwind, and code Playground

by Kevin Faulhaber

HTML

<div class="results">
 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 
</div>

<div class="results">
 , , , , hello , hi , one , two , three , , , , , , , , , , , , , , , , , , , , , , , , , 
</div>

JavaScript

//res is not an array so slice methods etc... will not work.
var res = document.getElementsByClassName('results');

function recursiveBeauty(results, i)
{
    if(results.length > i)
    {
        results[i].innerHTML = results[i].innerHTML.split(',').split(' ').join('');
        recursiveBeauty(results, i+1);      
    }
}

recursiveBeauty(res, 0);