JSFiddle - React, Tailwind, and code Playground

by James

JavaScript

str = "    This    should  become   something          else   too . ";
alert(str = str.replace(/ +(?= )/g,''));