title: Javascript: Looping through the characters of elements in an array
body: <p>I have the following problem:</p>
  
  <p>Write a function that takes in a list of words, and returns an object that tells you how many times each letter showed up.</p>
  
  <p>So something like this:</p>
  
  <pre><code>var data = ['hat', 'cat', 'dog'];
  </code></pre>
  
  <p>becomes:</p>
  
  <pre><code>var object = {
    'a' : 2,
    'h' : 1,
    't' : 2,
    'c' : 2,
    'd' : 1,
    'g' : 1
  };
  </code></pre>
  
  <p>My solution thus far has been to:</p>
  
  <ol>
  <li>Create a function with a blank object.</li>
  <li>Loop through all the elements of the array</li>
  </ol>
  
  <p>These steps aren't working like I think they were: </p>
  
  <ol start="3">
  <li>Try to loop through the characters of each array element.</li>
  <li>If the character of the array element is undefined in the object, put it in and increment to one. Otherwise if its already there, increment it by one again.</li>
  </ol>
  
  <p>Where am I going wrong? Or am I way off?</p>