title: How to filter a dictionary by value in JavaScript?
body: <p>I am writing a script to create a dictionary called <em>dict</em>, where I store the the frequencies of some words that I have in a text area. My array looks like this:</p>
  
  <pre><code>var dict = removeArray.reduce(function(p,c) {
      if (p[c] === undefined) {
          p[c] = 1;
      } else {
          p[c]++;
      }
      return p;
  }, {});
  </code></pre>
  
  <p>I would like to filter the elements of this dictionary by their value. I need to create a list with the words that have a value greater than one. My dictionary looks like this:</p>
  
  <pre><code>{
      "92173": 6,
      "C": 6,
      "GJHGWO.NAYE": 1,
      "GJHGX4.NAYE": 1,
      "GJHGX6.NAYE": 1,
      "GJHGX8.NAYE": 1,
      "GJHGXA.NAYE": 1,
      "GJHGXC.NAYE": 1,
      "RBD": 10,
      "RBD3": 2,
      "SAMBORNSiPOSSSTHRa": 2,
      "SAMBORNSiPOSSSTHRa1": 2,
      "SAMBORNSiPOSSSTHRa2": 2,
      "X": 4,
      "X3": 2
  }
  </code></pre>
  
  <p>In order to achieve that I tried using lodash, as follows:</p>
  
  <pre><code>var filtered = _.find(dict, function(user) {
      return user.frecuency &gt; 1;
  });
  </code></pre>
  
  <p>But I failed since I got:</p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>I don't know how to use lodash appropriately to filter this array.</p>
  
  <p>My complete code looks like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var splitWords = document.getElementById("texto").value.split(/[["\|~]/);
  var removeArray  = _.remove(splitWords, function (word) {
      return word !== '' &amp;&amp; word !== ' ' &amp;&amp; word !== '\n'
  });
  
  var dict = removeArray.reduce(function(p,c) {
      if (p[c] === undefined) {
          p[c] = 1;
      } else {
          p[c]++;
      }
      return p;
  }, {});
  console.log(dict);
  
  var filtered = _.find(dict, function(user) {
    return user.frecuency &gt; 1;
  });
  
  console.log(filtered)</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"&gt;&lt;/script&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  &lt;textarea cols="150" rows="15" id="texto"&gt;
  "RBD|X|RBD3|C|92173~GJHGWO.NAYE"
  "SAMBORNSiPOSSSTHRa1"
  "RBD|X|RBD|C|92173~GJHGX4.NAYE"
  "SAMBORNSiPOSSSTHRa"
  "RBD|X3|RBD3|C|92173~GJHGX6.NAYE"
  "SAMBORNSiPOSSSTHRa1"
  "RBD|X|RBD|C|92173~GJHGX8.NAYE"
  "SAMBORNSiPOSSSTHRa2"
  "RBD|X|RBD|C|92173~GJHGXA.NAYE"
  "SAMBORNSiPOSSSTHRa2"
  "RBD|X3|RBD|C|92173~GJHGXC.NAYE"
  "SAMBORNSiPOSSSTHRa"
  &lt;/textarea&gt;</code></pre>
  </div>
  </div>
  </p>