How to make Javascript “toString” implicite method culture aware
问题 in my ASP.NET MVC project, I need to make the JavaScript implicite string representation to be current culture aware , in particular with decimal separators. For example: var nbr = 12.25; console.log(nbr); Here, the console.log(nbr) must display "12.25" in EN-US and "12,25" in fr-FR, without having to explicitly call the toString() method. Does anyone know a way to accomplish this please? 回答1: You are probably looking for toLocaleString(); : The toLocaleString() method returns a string with a