remove whitespaces from begining string javascript code example
Example 1: remove whitespace with regex javascript
return str.replace(/\s/g, '');
Example 2: remove whitespace javascript
var str = " Some text ";
str.trim();
return str.replace(/\s/g, '');
var str = " Some text ";
str.trim();