title: Hackerrank: Hash tables- Ransom note
body: <p>trying to resolve this problem on hacker rank with Javascript:
  <a href="https://www.hackerrank.com/challenges/ctci-ransom-note" rel="nofollow">https://www.hackerrank.com/challenges/ctci-ransom-note</a></p>
  
  <p>Would love some help as I'm not passing all the test cases, my code is:</p>
  
  <pre><code>function main() {
      var m_temp = readLine().split(' ');
      var m = parseInt(m_temp[0]);
      var n = parseInt(m_temp[1]);
      magazine = readLine().split(' ');
      ransom = readLine().split(' ');
      var hashTable = {};
      var counter = 0;
      for (var i = 0; i &lt; ransom.length; i++) {
          hashTable[i] = ransom[i];
      }
      for (keys in hashTable) {
          if (magazine.hasOwnProperty(keys)) {
              counter +=1;
          } else { 
              counter -=1;
          }
      }
      console.log(counter &gt;= n ? "Yes" : "No");
  }
  </code></pre>
  
  <p>Much appreciated!!</p>