Ajax filter through JavaScript with AND, OR condition

yes. can you help me in code ? @James_Hibbard , @chorn
not getting result when tried these combination in code

if (in_array("bs", $opts)){
    $where .= " AND bs = '1' AND (cs='yes' OR ec='yes') ";
  }

i also tried this

if (in_array("bs", $opts)) {
	$where .= " AND bs = '1' ";
	if (in_array("cs", $opts)){
    $where .= " OR cs = 'yes' ";
	if (in_array("cs", $opts)){
    $where .= " OR es = 'yes' ";
  }
}

and this

 if (in_array_all("bs","cs","ec", $opts)){
   $where .= " AND bs = '1' AND (cs = 'yes' OR ec='yes') ";
 }

thanks in advance !