title: Should I use a JSON Array or an Object?
body: <p>I have the following code :</p>
  
  <pre><code>$.each( orderedqty, function( priority, quantity ) {
  
      // for each priority
  
      if ( $(".switch[data-priorityid=" + priority + "]").attr("data-state") == "on" ) {
  
          // this priority is checked
  
          orderedqtyArray[ priority ] = 15;
  
      } else {
  
          orderedqtyArray[ priority ] = 10;
  
      }
  
  });
  
  console.info( orderedqtyArray );
  console.info( JSON.stringify( orderedqtyArray ) );
  </code></pre>
  
  <p>The problem is this code returns :</p>
  
  <blockquote>
    <p>[77: 15, 78: 15]<br>
    [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,15,15]</p>
    
    <p>[78: 15]<br>
    [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,15]</p>
  </blockquote>
  
  <p>Instead of a beautiful json :(</p>