How to remove trailing zeros from a string in Node.js

1 Answer

0 votes
let str = "477822.1241000";

str = str.replace(/0+$/, '');

console.log(str);



/*
run:
 
477822.1241
 
*/

 



answered Nov 15, 2024 by avibootz

Related questions

2 answers 172 views
1 answer 128 views
1 answer 175 views
1 answer 130 views
...