how to remove whitespace only from first position of string js

Solutions on MaxInterview for how to remove whitespace only from first position of string js by the best coders in the world

showing results for - "how to remove whitespace only from first position of string js"
Nicola
13 Mar 2019
1function ltrim(str) {
2  if(!str) return str;
3  return str.replace(/^\s+/g, '');
4}
5