title: When to use arrays within JavaScript objects (or mix them)?
body: <p>Very often I see data structures like this:</p>
  
  <pre><code>var settings = {
      languages: [
          {
              language: 'English',
              translation: 'English',
              langCode: 'en',
              flagCode: 'us'
          },
          {
              ...
          }
      ]
  };
  </code></pre>
  
  <p>Or this:</p>
  
  <pre><code>var settings = {
      languages: [
          {
              'en' : {
                  language: 'English',
                  translation: 'English',
                  flagCode: 'us'
              }
          },
          {
              ...
          }
      ]
  };
  </code></pre>
  
  <p>And this can go many levels deep (within an object there are often other arrays containing further objects)... </p>
  
  <p>Adding arrays brings in another level of complexity when arrays have to be looped through to find a certain object, if we don't know its position in the array. But even if know its position it's still more complicated to use than using purely nested objects, where everything can easily be referred to, using dot notation. Like in this case:</p>
  
  <pre><code>var settings = {
      languages: {
          'en' : {
              language: 'English',
              translation: 'English',
              flagCode: 'us'
          },
          'de' : {
              ...
          }
      }
  };
  </code></pre>
  
  <p>So when is it a good idea to use arrays within objects and when not? </p>