title: How to check if a number has two decimal places and keep the trailing zero if necessary?
body: <p>If you have these numbers:</p>
  
  <ul>
  <li><p>2</p></li>
  <li><p>2.05</p></li>
  <li><p>2.547</p></li>
  <li><p>2.5</p></li>
  </ul>
  
  <p>How can I do a check to see if the number has two decimal places?</p>
  
  <p>If it has 2 decimals, how do you drop the second decimal number (rounding) but keep the trailing 0 if needed?</p>
  
  <p>Examples of results:</p>
  
  <pre><code>2.05 would end in 2.1
  2.04 would end in 2.0
  2.54 would end in 2.5
  </code></pre>
  
  <p>I realise you can use toFixed(1), but that converts it to a string. And if you convert it to a int with parseInt(), it loses the trailing zero</p>
  
  <p>Thanks guys</p>