How to remove trailing spaces from string in JavaScript

1 Answer

0 votes
let str = 'javascript,c,c++,python     ';
 
str = str.trimEnd();
 
console.log(str); 
 
   
   
   
   
/*
run:
   
"javascript,c,c++,python"
   
*/

 



answered Jun 9, 2022 by avibootz

Related questions

1 answer 178 views
1 answer 150 views
1 answer 168 views
1 answer 214 views
1 answer 238 views
...