title: Count occurances in string from keyword array in javascript
body: <p>I have an array:</p>
  
  <pre><code>var locations = ['Afghanistan','Albania','Algeria','New York'];
  </code></pre>
  
  <p>and a string:</p>
  
  <pre><code>var string = 'I love Afghanistan New York Afghanistan Andorra Andorra Algeria New York';
  </code></pre>
  
  <p>I want to count the number of times each keyword in the array appears in the string but can't figure out the best way to do that.</p>