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);
   });
});

```
Check this with `for in` loop: 

```js
var fruitColor = {
    'color': "Yellow",
    'fruits': []
},
fruits = {
    'title': "Banana",
    'color': "Yellow"
}

for(key in fruitColor){
  if(fruitColor.hasOwnProperty(key)){
    if(fruits[key] === fruitColor[key]){
       fruitColor.fruits.push(fruits["title"])
    }
  }
}

document.body.innerHTML = '<pre>' + JSON.stringify(fruitColor.fruits) +'</pre>';
```