title: Map of alphabet - how many times each letter occurs in a string (including 0)
body: <p>I am writing a function that returns an array of how many times each letter of the alphabet (a-z) occurs in a string, including 0. This array only contains 26 numbers. So far this is the function I've come up with. It works, but I feel like must be a cleaner way to refactor this solution.</p>
  
  <pre><code>export function generateMap(text){
  
   const text_arr = text.toLowerCase().split('');
   const valid_char = 'abcdefghijklmnopqrstuvwxyz'.split('')
  
   const map = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
  
  
   text_arr.forEach(char =&gt; {
     if(valid_char.indexOf(char) &gt; -1) map[char]++
   })
  
   return Object.values(map)
  
  }
  </code></pre>