I hate to admit it, but I found myself struggling with a simple task the other day - creating an array.
Let me explain my dilemma.
I am trying to populate an array in the following format:
fatherArray=[
{
tagName: '',
list:[]
}
]
The problem is, I can't use fatherArray.push() without having the object already set up. I have multiple tags and lists, and for instance, I need to check if someone on the list is related to rock music, and then update the tag with 'rock' and create a list of those individuals. ( I've already achieved this, now I just need to populate the array as shown below )
So, how can I populate this array? I want it to look something like this:
fatherArray=[
{
tagName: 'rock',
list:['iron','metallica',... ]
},
{
tagName: 'pop',
list:['madona','britney']
},
{
tagName: 'hip hop',
list:['travis','lild',... ]
},
{
tagName: 'bla bla bla',
list:['bla', 'bla', 'bla', 'bla']
}
]