title: return boolean using .filter()
body: <p>I am trying to get return a boolean from the below code</p>
  
  <pre><code>data = [{name: "Jack", value: "Y", city: "NY"},
          {name: "John", value: "Y", city: "NJ"},
          {name: "John", value: "N", city: "NY"}]
  </code></pre>
  
  <p><em>From the above data I want to return a boolean by using filter based on city as NY and who has a value of "Y"</em></p>
  
  <p>Tried following ways</p>
  
  <pre><code>const trail1 = data.filter(function (item) {
                  return Boolean(item.city === "NY" &amp;&amp; item.value === "Y");
              });
  
  const trail2 = data.filter(function (item) {
          return (item.city === "NY" &amp;&amp; item.value === "Y");                               
      }).length === 1;
  
  
  const trail3 = data.some(function(item){
    return item === (item.city === "NY" &amp;&amp; item.value === "Y");
  });
  </code></pre>
  
  <p><strong><em>trail1</em></strong> returns the array object which satisfies the condition but it doesn't return either true or false</p>
  
  <p><strong><em>trail2</em></strong> returns true or false based on data. But want to know if there is any better way of doing it instead of using <strong><em>.length</em></strong></p>
  
  <p><strong><em>trail3</em></strong> returns false always not sure what is going wrong with it. As it has the city as NY and value = Y exists in the <em>data</em> object</p>
  
  <p><strong><em>followed</em></strong> <a href="https://stackoverflow.com/questions/39750037/returning-true-if-javascript-array-contains-an-element">Returning true if JavaScript array contains an element</a> <strong><em>but that didn't help</em></strong></p>