Replace all dots with comma from string using JavaScript

 

Use the replaceAll() method to replace all dots with commas . The replaceAll method will return a new string where all dots are replaced with commas 

 

let result = myString.replace( /\,/g, ".");

 

var number ="12,34567";
number = number.replace(",", ".");
console.log( number );

Tags:

Share:

Related posts