title: How to increment number by 0.01 in javascript using a loop?
body: <h3>Problem</h3>
  <p>I was trying to build out a list of heights in the console by meteres starting from 1.20m and ending up at 2.50m.</p>
  <p>I used this code:</p>
  <pre><code>var heights = [];
  for ( var i=1.20, l=2.5; i&lt;l; i+=0.01 ){
  
      heights.push(i);
  
  }
  
  heights = heights.join('\n');
  </code></pre>
  <p>If I <code>console.log( heights )</code> I get:</p>
  <pre><code>1.2
  1.21
  1.22
  1.23
  ...
  </code></pre>
  <p>But then at 1.37 I start getting:</p>
  <pre><code>1.37
  1.3800000000000001
  1.3900000000000001
  1.4000000000000001
  1.4100000000000001
  1.4200000000000002
  1.4300000000000002
  </code></pre>
  <h3>Questions</h3>
  <ul>
  <li>What's going on?</li>
  <li>How do I fix it?</li>
  </ul>
  <h3>Demo</h3>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var heights = [];
  for ( var i=1.20, l=2.5; i&lt;l; i+=0.01 ){
  
      heights.push(i);
  
  }
  
  var heights = heights.join('\n');
  
  document.querySelector('#output').innerText = heights;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset=utf-8 /&gt;
  &lt;title&gt;JS Bin&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="output"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>