title: Add a rounding method to Number.prototype in JavaScript
body: <p>How can I simplify rounding in JavaScript? I wish that I could do it in a more elegantly in an object-oriented manner. The method toFixed works well, but does not have backward rounding and it also returns a string and not a number.</p>
  
  <pre><code>pi.toFixed(2).valueOf();
  // 3.14
  </code></pre>
  
  <p>As it is, rounding is a bit of a tangle because I have to use:</p>
  
  <pre><code>pi = Math.round(pi * 100) / 100;
  // 3.14
  </code></pre>
  
  <p>It would be much nicer instead just to stick a method to the end of a variable, such as:</p>
  
  <pre><code>pi.round(2);
  // 3.1r
  </code></pre>