title: How to push object to array from for loop properly in JavaScript?
body: <p>I want to make an array that including object by for loop but there is a problem, The shape what I want is below : </p>
  
  <pre><code>[ 
    { data: 'apple', label: 'Fruits'  },
    { data: 'banana', label: 'Fruits' },
    { data: 'mango', label: 'Fruits'  } 
  ]   
  </code></pre>
  
  <p>So I tried to below way, but It's not working properly.</p>
  
  <pre><code>var arr = [];
  obj = {};
  var fruits = ['banana', 'apple', 'mango'];
  var label = 'Fruits';
  
  for (var i=0; i&lt;fruits.length; i++){
      obj['data'] = fruits[i];
      obj['label'] = label;
      arr.push(obj);
  }
  
  console.log(arr);
  </code></pre>
  
  <p>The result is just same object pushed.</p>
  
  <pre><code>[
    { data: 'apple', label: 'Fruits' },
    { data: 'apple', label: 'Fruits' },
    { data: 'apple', label: 'Fruits' } 
  ]
  </code></pre>
  
  <p>Is this because of closer function ? How can I make it well? </p>