Answers for "javascript remove spaces from start and end"

3

javascript remove spaces at the beginning of the end of the string

const stringWithSpaces = '   I learn JS with Coderslang every day   ';

console.log(stringWithSpaces.trimStart());  //'I learn JS with Coderslang every day   '
console.log(stringWithSpaces.trimEnd());    //'   I learn JS with Coderslang every day'
console.log(stringWithSpaces.trim());       //'I learn JS with Coderslang every day'
Posted by: Guest on February-03-2021
2

js remove spaces

str = str.trim();
Posted by: Guest on July-02-2020

Code answers related to "javascript remove spaces from start and end"

Code answers related to "Javascript"

Browse Popular Code Answers by Language