Answers for "remove trailing spaces in javascript"

47

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
6

remove space from string javascript

var str = "       Hello World!        ";
alert(str.trim());
Posted by: Guest on March-19-2020
0

javascript remove first space in string

//use trim() on your string. It removes first and last whitepsaces

let str = " aa bb    ";
console.log(str.trim()); // "aa bb"
Posted by: Guest on August-20-2020
1

how to remove trailing space in string js

let string = "        Your Text           ";
string = string.trim(); // "Your Text"
// This gets rid of both starting and trailing whitespace
Posted by: Guest on June-02-2021

Code answers related to "remove trailing spaces in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language