title: Javascript: How to retrieve the number of decimals of a *string* number?
body: <p>I have a set of string numbers having decimals, for example: <code>23.456</code>, <code>9.450</code>, <code>123.01</code>... I need to retrieve the number of decimals for each number, knowing that they have at least 1 decimal.</p>
  
  <p>In other words, the <code>retr_dec()</code> method should return the following:</p>
  
  <pre><code>retr_dec("23.456") -&gt; 3
  retr_dec("9.450")  -&gt; 3
  retr_dec("123.01") -&gt; 2
  </code></pre>
  
  <p>Trailing zeros do count as a decimal in this case, unlike in this <a href="https://stackoverflow.com/questions/9539513/is-there-a-reliable-way-in-javascript-to-obtain-the-number-of-decimal-places-of">related question</a>.</p>
  
  <p>Is there an easy/delivered method to achieve this in Javascript or should I compute the decimal point position and compute the difference with the string length? Thanks</p>