Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two object array, I want to compare the particular value in both array object.
How can I search

I Have tried like below
First Array Object => ar
Second Array Object => result

C#
strTab1 = "";
 var temp_clm = 0;
 debugger;

 for (var i = 0; i < ar.length; i++) {

     arr = jQuery.grep(ar, function (n, i) {

         if (ar[i] == result) {
             return 3;
         }

     });



     if (arr!=3) {
         strTab1 += "<td>0</td>";
     }
     else
     {
         strTab1 += "<td>" + result[temp_clm].CountVal + "</td>";
         temp_clm++;
     }
 }
Posted
Comments
Mehul v Patel 14-Nov-14 0:19am    
You have check particular value in both array object that are present or not right ?

1 solution

I think Below code is helpful to you......

C#
$array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
 
The above example will output:
 
Array
(
[a] => green
[0] => red
)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900