Question: I've two objects, one with fruit colors:

```
fruitColor = {
    'color': "Yellow",
    'fruits': []
}

```

And the second with fruits:

```
fruits = {
    'title': "Banana",
    'color': "Yellow"
}

```

How can I match the both .color (and add/push fruits to fruitColor.fruits) in a simple way? Both colors and fruits contains multiple.

I've tried jQuery .map() and .each() but not sure how to use it in this example.

Answer: 
```
$.each(fruits,function(i,v){
   $.each(fruitColor,function(i2,v2){
      if (v.color == v2.color)
        v2.fruits.push(v.title);
   });
});

```
Aren't your objects array of object ? More like this :

```
fruitColor = [{
    'color': "Yellow",
    'fruits': []
   },
   {
     'color': "Green",
     'fruits': []
   }]

fruits = [{
        'title': "Banana",
        'color': "Yellow"
      },
      {
        'title': "Apple",
        'color': "Green"
      }];

```

If it is, you can do :

```
for (var i = 0; i < fruits.length; i++){
   for (var j = 0; j < fruitColor.length; i++){
      if (fruitColor[j].color == fruits[i].color)
        fruitColor[j].fruits.push(fruits[i].title);
        break;
   }
}

```