JSFiddle - React, Tailwind, and code Playground

by Blender

JavaScript

function innerTrim(str) {
    do {
        str.replace('  ', ' ');
    } while (str.indexOf('  ') != -1);


    return str;
}

alert(innerTrim('a         s'));