JSFiddle - React, Tailwind, and code Playground
by rlemon
JavaScript
(function($) {
$.stripSpaces = function(str) {
var reg = new RegExp("[ ]+","g");
return str.replace(reg,"");
}
})(jQuery);
document.write($.stripSpaces("123 456"));
document.write("<br />");
document.write($.stripSpaces(" 123 456 "));
document.write("<br />");
document.write($.stripSpaces(" 1 2 3 4 5 6 "));