How to replace a comma with a dot in Node.js

2 Answers

0 votes
let str = '12,449,327,099';
 
str = str.replaceAll(',', '.');
 
console.log(str); 
   
 
 
   
/*
run:
   
12.449.327.099
   
*/

 



answered May 21, 2022 by avibootz
0 votes
let str = '12,449,327,099';
 
str = str.replace(/,/g, '.')
 
console.log(str); 
   
 
 
   
/*
run:
   
12.449.327.099
   
*/

 



answered May 21, 2022 by avibootz

Related questions

1 answer 198 views
1 answer 263 views
1 answer 199 views
1 answer 184 views
2 answers 220 views
2 answers 232 views
...