title: What is the decimal separator symbol in JavaScript?
body: <p>A thought struck me as I was writing a piece of JavaScript code that processed some floating point values. What is the decimal point symbol in JavaScript? Is it always <code>.</code>? Or is it culture-specific? And what about <code>.toFixed()</code> and <code>.parseFloat()</code>?  If I'm processing a user input, it's likely to include the local culture-specific decimal separator symbol.</p>
  
  <p>Ultimately I'd like to write code that supports both decimal points in user input - culture-specific and <code>.</code>, but I can't write such a code if I don't know what JavaScript expects.</p>
  
  <p><strong>Added:</strong> OK, Rubens Farias <a href="https://stackoverflow.com/questions/2085275/what-is-the-decimal-separator-symbol-in-javascript/2085307#2085307">suggests</a> to look at <a href="https://stackoverflow.com/questions/1074660/with-a-browser-how-do-i-know-which-decimal-separator-does-the-client-use">similar question</a> which has a neat accepted answer:</p>
  
  <pre><code>function whatDecimalSeparator() {
      var n = 1.1;
      n = n.toLocaleString().substring(1, 2);
     return n;
  }
  </code></pre>
  
  <p>That's nice, it lets me get the locale decimal point. A step towards the solution, no doubt.</p>
  
  <p>Now, the remaining part would be to determine what the behavior of <code>.parseFloat()</code> is. Several answers point out that for floating point literals only <code>.</code> is valid. Does <code>.parseFloat()</code> act the same way? Or might it require the local decimal separator in some browser? Are there any different methods for parsing floating point numbers as well? Should I roll out my own just-to-be-sure?</p>