title: Difference between push and assignment in JavaScript array
body: <pre><code>async getModifiedData() {
    let dbData = await dbdata.getData();
    
    let fileData = [];
  
    dbData.map(data =&gt; {
      fileData[data[&quot;uniquePropertyName&quot;]] = data;
    });
  
    return fileData; // here I'm getting empty array
  }
  </code></pre>
  <p>Whereas I get filled array when using <code>push()</code> method,</p>
  <pre><code>async getModifiedData() {
    let dbData = await dbdata.getData();
    
    let fileData = [];
  
    dbData.map(data =&gt; {
      let propertyName = data[&quot;uniquePropertyName&quot;];
      let obj = {};
      obj[propertyName] = data;
      fileData.push(obj);
    });
  
    return fileData; // here I'm getting filled array
  }
  </code></pre>
  <p>Both are working correct when the array size is small but for larger array, <code>Array.push()</code> only returns filled array. Can anyone explain what's happening here.</p>