title: difference between push and normal array assignment in javascript
body: <p>I'm using  <a href="http://code.google.com/p/flot/" rel="nofollow">flot</a> api to draw charts. Look at this chart type <a href="http://people.iola.dk/olau/flot/examples/interacting.html" rel="nofollow">HERE</a>.<br>
  In that example they've used values like,  </p>
  
  <pre><code>var sin = [], cos = [];
    for (var i = 0; i &lt; 14; i += 0.5) {
          sin.push([i, Math.sin(i)]);
          cos.push([i, Math.cos(i)]);
    }
  </code></pre>
  
  <p>Now the chart was drawn "curved" lines, when i replaced the  </p>
  
  <pre><code>sin.push([i, Math.sin(i)]);
  cos.push([i, Math.cos(i)]);
  </code></pre>
  
  <p>with,</p>
  
  <pre><code>sin[i]=[i, Math.sin(i)];
  cos[i]=[i, Math.cos(i)];
  </code></pre>
  
  <p>Then the chart gets drawn using straight lines. I've two questions now.  </p>
  
  <p>1) What is the difference between the two types of array assignments?<br>
  2) Is this because of difference in array assignments or the API behaviour?  </p>
  
  <p>any help greatly appreciated! Thanks.</p>
  
  <p><strong>Edit:</strong> Set i to increment by 1 and set different values using push method or default assignment, you'll get the same result.</p>