title: Is there a difference in Initializing javascript variable using [] versus {}
body: <p>Well I have always used</p>
  
  <pre><code>var j= {};
  j['field'] = value;
  </code></pre>
  
  <p>Apparently below works too</p>
  
  <pre><code>var j= [];
  j['field'] = value;
  </code></pre>
  
  <p>Any difference?</p>
  
  <p>Edit: Sorry I guess I used the wrong word json here instead of object. My bad. But my questions till stands. Most people are explaining the difference between an array and object to me which I am familiar with. </p>
  
  <p>I always do var x = []; x.push('blah') etc.</p>
  
  <p>I also do var x = {}; x.Name = 'Michael'; x.Age = 21 etc.</p>
  
  <p>What I was surprised to see and what prompted me to ask this is I saw code that goes like 
  var x = [];
  x.name = 'Michael';</p>
  
  <p>This is something I wasn't used to and hence posted the question.</p>
  
  <p>Thanks for all the answers. I have marked accepted answer which addressed my question the best</p>