I have some problems figuring out how to group to certain variables in javascript.
Here is the deal.
I have one array containing categories in my case right now categories A-Z but it could be anything (Animals - dogs - cats - etc).
In another array I have a result from an xml file with different content (title, content and category). In my case the category containing letters from A-Z corresponding to the category in my other array.
So what I want to do is first of all output one div for each category from the category array. When that is done I want to add inside each div the matching category items form my other array.
This is an example
First output from my category array:
<div id="A"></div>
<div id="B"></div>
<div id="C"></div>
<div id="D"></div>
Second I want to add inside those divs the array objects that has a matching category inside them A, B, C etc.
<div id="A">
<div id="contentFromMyOtherArray"> this object comes from my other array and had the content category A </div>
<div id="contentFromMyOtherArray"> this object also comes from my other array and had the content category A still inside the A div </div>
</div>
<div id="B">
<div id="contentFromMyOtherArray"> this object comes from the array and had the content category B </div>
</div>
And so on...
Is this even possible?
EDIT: My First array only holds A, B, C, D, E etc so when iterating thru it array[i] i will get A B C D etc
My second array holds title category etc so if i want to have only the category i could iterate thru it like this arrMarkers[i].category. That would output ex. A A A B B E E F F F etc based on what categories the content of each array holds