title: Filtering results from an object
body: <p>I need a dropdown to filter some results from a table. So far I turned the table into an object and got the selected value in the dropdown but I can't filter the results because the filter function only works with arrays. It's supposed show all that the class <code>subtema</code> equals the value of the dropdown. How can I make this filter work?</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 arrayValores = [];
  var objecto;
  
  function converter() {
    $("#tabela tr").each(function() {
      var arrayRow = [];
      var tableData = $(this).find('td');
      if (tableData.length &gt; 0) {
        tableData.each(function() {
          arrayRow.push($(this).text());
        });
        arrayValores.push(arrayRow);
      }
    });
  
    objecto = arrayValores.map(function(x) {
      return {
        "tema": x[0],
        "subtema": x[1],
        "cenario": x[2],
        "motivo": x[3],
        "tipo": x[4],
        "subtipo": x[5],
        "observacao": x[6]
      }
    });
  }
  
  function filtrarAnt(valor) {
    console.log(valor);
    var resultado = objecto.filter(objecto.subtema === valor);
    if (resultado === true) {
      console.log("it's working!");
    } else {
      console.log("not working");
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body onload="converter()"&gt;
    &lt;table id="tabela" class="hide"&gt;
      &lt;tr class="row1"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Transferências&lt;/td&gt;
        &lt;td&gt;Para a Retenção&lt;/td&gt;
        &lt;td&gt;Transferencia&lt;/td&gt;
        &lt;td&gt;Retencion&lt;/td&gt;
        &lt;td&gt;Retencion&lt;/td&gt;
        &lt;td&gt;Deves especificar o assunto tratado em chamada e o que motivou a transferência.&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row2"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Transferências&lt;/td&gt;
        &lt;td&gt;Para o departamento MEDEM&lt;/td&gt;
        &lt;td&gt;Transferencia&lt;/td&gt;
        &lt;td&gt;Empresas&lt;/td&gt;
        &lt;td&gt;Empresas&lt;/td&gt;
        &lt;td&gt;-&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row3"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Transferências&lt;/td&gt;
        &lt;td&gt;Para as Reclamações (GEIR)&lt;/td&gt;
        &lt;td&gt;Transferencia&lt;/td&gt;
        &lt;td&gt;Reclamaciones&lt;/td&gt;
        &lt;td&gt;Reclamaciones&lt;/td&gt;
        &lt;td&gt;Deves especificar o assunto tratado em chamada e o que motivou a transferência.&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row4"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Transferências&lt;/td&gt;
        &lt;td&gt;Para a linha de assistência técnica do SUE, em caso de urgência elétrica reportada pelo cliente&lt;/td&gt;
        &lt;td&gt;Transferencia&lt;/td&gt;
        &lt;td&gt;SAT Productos y servicios&lt;/td&gt;
        &lt;td&gt;SAT Productos y servicios&lt;/td&gt;
        &lt;td&gt;Obrigatoriamente Deves incluir na interação uma breve descrição da chamada e o número do pedido que registaste em IC (nº de processo).&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row5"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Transferências&lt;/td&gt;
        &lt;td&gt;Para Smart Services, no âmbito de Smart Mobility&lt;/td&gt;
        &lt;td&gt;Información comercial&lt;/td&gt;
        &lt;td&gt;Servicios&lt;/td&gt;
        &lt;td&gt;Smart Mobility&lt;/td&gt;
        &lt;td&gt;-&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row6"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Transferências&lt;/td&gt;
        &lt;td&gt;Para Smart Services, no âmbito de Smart Solar&lt;/td&gt;
        &lt;td&gt;Información comercial&lt;/td&gt;
        &lt;td&gt;Servicios&lt;/td&gt;
        &lt;td&gt;Smart Solar&lt;/td&gt;
        &lt;td&gt;-&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row7"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Atualização BD&lt;/td&gt;
        &lt;td&gt;Houve a atualização da Base de Dados do cliente&lt;/td&gt;
        &lt;td&gt;Mantenimiento&lt;/td&gt;
        &lt;td&gt;Cliente&lt;/td&gt;
        &lt;td&gt;Unificación DNI&lt;/td&gt;
        &lt;td&gt;Deves indicar na interação quais os dados que alteraste/atualizaste.&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row8"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Avarias&lt;/td&gt;
        &lt;td&gt;Dei o número para avarias de Eletricidade (E-Redes)&lt;/td&gt;
        &lt;td&gt;Averías&lt;/td&gt;
        &lt;td&gt;Electricidad&lt;/td&gt;
        &lt;td&gt;Outra distribuidora&lt;/td&gt;
        &lt;td&gt;Deves descrever, de forma objetiva, o assunto que foi tratado em chamada.&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row9"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Avarias&lt;/td&gt;
        &lt;td&gt;Dei o número para avarias de gás (Distribuidores da lista, no Diogo)&lt;/td&gt;
        &lt;td&gt;Averías&lt;/td&gt;
        &lt;td&gt;Gas&lt;/td&gt;
        &lt;td&gt;Distribuidora&lt;/td&gt;
        &lt;td&gt;Deves descrever, de forma objetiva, o assunto que foi tratado em chamada.&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row10"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;Chamada caiu&lt;/td&gt;
        &lt;td&gt;A chamada do cliente caiu&lt;/td&gt;
        &lt;td&gt;Cierre rápido&lt;/td&gt;
        &lt;td&gt;Llamada interrumpida&lt;/td&gt;
        &lt;td&gt;Llamada interrumpida&lt;/td&gt;
        &lt;td&gt;Deves indicar o contexto/tema da chamada, caso tenha havido tempo para o cliente explicar.&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row11"&gt;
        &lt;td&gt;Atendimento&lt;/td&gt;
        &lt;td&gt;LOPD&lt;/td&gt;
        &lt;td&gt;O cliente não fornece dados suficientes para validação do LOPD&lt;/td&gt;
        &lt;td&gt;Cierre rápido&lt;/td&gt;
        &lt;td&gt;No pasa LOPD&lt;/td&gt;
        &lt;td&gt;No pasa LOPD&lt;/td&gt;
        &lt;td&gt;Deves indicar quais os dados que o cliente indicou&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  
    &lt;select onchange="filtrarAnt(this.value)"&gt;
      &lt;option&gt;subtema&lt;/option&gt;
      &lt;option&gt;Transferências&lt;/option&gt;
      &lt;option&gt;atualização bd&lt;/option&gt;
      &lt;option&gt;avarias&lt;/option&gt;
      &lt;option&gt;chamada caiu&lt;/option&gt;
      &lt;option&gt;lopd&lt;/option&gt;
    &lt;/select&gt;
  
    &lt;script data-require="jquery@2.0.3" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"&gt;&lt;/script&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>