title: How to remove zero after decimal point on a float using javascript
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4098685/jquery-rounding-numbers-to-2-digits-after-comma">jQuery: rounding numbers to 2 digits after comma</a>  </p>
  </blockquote>
  
  
  
  <p>While printing out a number in JavaScript, I only want keep only three digits after the decimal point. The code I am using shows more than 8 digits after the decimal point. Could anyone guide me on how to remove the remaining digits using JavaScript.</p>
  
  <p>This is my JavaScript code:</p>
  
  <pre><code>function  doMath() { 
  
     var nvalue; var amount;
     var price= 0.27;
     nvalue = document.getElementById("message").value;
  
     amount=(nvalue*price);
  
     document.getElementById("total").value=amount ;
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <p>4.050000000000001</p>
  </blockquote>
  
  <p>I want:</p>
  
  <blockquote>
    <p>4.050 </p>
  </blockquote>
  
  <p>Any help would be appreciated, thank you.</p>