Javascript - How to remove the white space at the start of the string

后端 未结 9 1414
清酒与你
清酒与你 2020-12-15 06:20

I want to remove the white space which is there in the start of the string It should remove only the space at the start of the string, other spaces should be there.

9条回答
  •  遥遥无期
    2020-12-15 06:35

    You should use javascript trim function

    var str = "       Hello World!        ";
    alert(str.trim()); 
    

    This function can also remove white spaces from the end of the string.

提交回复
热议问题