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 177 views
1 answer 144 views
1 answer 164 views
1 answer 210 views
1 answer 235 views
...