title: Number formatting in template strings (Javascript - ES6)
body: <p>I was wondering if it is possible to format numbers in Javascript template strings, for example something like:</p>
  
  <pre><code>var n = 5.1234;
  console.log(`This is a number: $.2d{n}`);
  // -&gt; 5.12
  </code></pre>
  
  <p>Or possibly</p>
  
  <pre><code>var n = 5.1234;
  console.log(`This is a number: ${n.toString('.2d')}`);
  // -&gt; 5.12
  </code></pre>
  
  <p>That syntax obviously doesn't work, it is just an illustration of the type of thing I'm looking for.</p>
  
  <p>I am aware of tools like <code>sprintf</code> from <code>underscore.string</code>, but this seems like something that JS should be able to do out the box, especially given the power of template strings.</p>
  
  <p><strong>EDIT</strong>  </p>
  
  <p>As stated above, I am already aware of 3rd party tools (e.g. sprintf) and customised functions to do this.  Similar questions (e.g. <a href="https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format">JavaScript equivalent to printf/String.Format</a>) don't mention template strings at all, probably because they were asked before the ES6 template strings were around.  My question is specific to ES6, and is independent of implementation.  I am quite happy to accept an answer of "No, this is not possible" if that is case, but what would be great is either info about a new ES6 feature that provides this, or some insight into whether such a feature is on its way.</p>