title: Filtering records by passing query in function from array
body: <p>I want to fetch records by passing query arguments to a function in JavaScript. </p>
  
  <pre><code>const data = [{
      name: "ab",
      class: 1,
      grade: "A",
      teacher: {
        teacherName: "tab",
        age: 34,
        school: "ab pblc scl"
      }
    },
    {
      name: "cd",
      class: 2,
      grade: "B",
      teacher: {
        teacherName: "efg",
        age: 35,
        school: "cd pblc scl"
      }
    }
  ]
  </code></pre>
  
  <p>My filter function arguments (1st argument is array and 2nd is query which can be anything)</p>
  
  <p>These are some test conditions. </p>
  
  <p><code>filterMe(data,{name : "cd", class:"2",teacherName:"efg"})</code> should return whole object</p>
  
  <pre><code>{
     name: "cd",
     class: 2,
     grade: "B",
     teacher: {
        teacherName: "efg",
        age: 35,
        school: "cd pblc scl"
     }
  }
  </code></pre>
  
  <p>any help will be highly appreciated.</p>