JSFiddle - React, Tailwind, and code Playground

by bvotcode

JavaScript

var str = '    Hello      ';
var trim = str.replace(/^\s+|\s+$/g, '');
console.log(trim);