Answers for "how to remove leading and trailing spaces in javascript"

48

javascript trim

var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removed
Posted by: Guest on June-27-2019
0

javascript remove leading blanks

let str = "       Hello World!        ";

str.trim()   // Returns "Hello World!"
Posted by: Guest on August-20-2021

Code answers related to "how to remove leading and trailing spaces in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language